Skip to content

Commit b5abc42

Browse files
committed
AArch64: bail instead of asserting on unexpected type in G_CONSTANT 0.
llvm-svn: 368031
1 parent 9eee425 commit b5abc42

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,8 @@ bool AArch64InstructionSelector::earlySelect(MachineInstr &I) const {
12961296

12971297
Register DefReg = I.getOperand(0).getReg();
12981298
LLT Ty = MRI.getType(DefReg);
1299-
assert((Ty == LLT::scalar(64) || Ty == LLT::scalar(32)) &&
1300-
"Unexpected legal constant type");
1299+
if (Ty != LLT::scalar(64) && Ty != LLT::scalar(32))
1300+
return false;
13011301

13021302
if (Ty == LLT::scalar(64)) {
13031303
I.getOperand(1).ChangeToRegister(AArch64::XZR, false);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel -O0 -o - %s | FileCheck %s
2+
3+
%struct.comp = type { i8*, i32, i8*, [3 x i8], i32 }
4+
5+
define void @regbranch() {
6+
; CHECK-LABEL: regbranch:
7+
; CHECK: mov {{w[0-9]+}}, #0
8+
cond_next240.i:
9+
br i1 false, label %cond_true251.i, label %cond_next272.i
10+
11+
cond_true251.i:
12+
switch i8 0, label %cond_next272.i [
13+
i8 42, label %bb268.i
14+
i8 43, label %bb268.i
15+
i8 63, label %bb268.i
16+
]
17+
18+
bb268.i:
19+
br label %cond_next272.i
20+
21+
cond_next272.i:
22+
%len.2.i = phi i32 [ 0, %bb268.i ], [ 0, %cond_next240.i ], [ 0, %cond_true251.i ]
23+
%tmp278.i = icmp eq i32 %len.2.i, 1
24+
ret void
25+
}

0 commit comments

Comments
 (0)