[PATCH] AArch64: Relax assert about large shift sizes.
Matthias Braun
matze at braunis.de
Mon Jan 12 15:28:29 PST 2015
Shift sizes larger than the size of the value in bits can happen if
constant folding fails.
Testcase based on rdar://19211454
http://reviews.llvm.org/D6940
Files:
lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
test/CodeGen/AArch64/large_shift.ll
Index: lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
===================================================================
--- lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
+++ lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
@@ -1424,8 +1424,10 @@
} else
return false;
- assert((BiggerPattern || (Srl_imm > 0 && Srl_imm < VT.getSizeInBits())) &&
- "bad amount in shift node!");
+ // Bail out on large immediates. This happens when no proper
+ // combining/constant folding was performed.
+ if (!BiggerPattern && (Srl_imm <= 0 || Srl_imm >= VT.getSizeInBits()))
+ return false;
LSB = Srl_imm;
MSB = Srl_imm + (VT == MVT::i32 ? CountTrailingOnes_32(And_imm)
Index: test/CodeGen/AArch64/large_shift.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AArch64/large_shift.ll
@@ -0,0 +1,18 @@
+; RUN: llc -march=aarch64 -o - %s
+target triple = "arm64-unknown-unknown"
+
+declare void @t()
+
+define void @foo() {
+ %c = bitcast i64 270458 to i64
+ %t0 = lshr i64 %c, 422383
+ %t1 = trunc i64 %t0 to i1
+ br i1 %t1, label %BB1, label %BB0
+
+BB0:
+ call void @t()
+ br label %BB1
+
+BB1:
+ ret void
+}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6940.18054.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150112/d573a4a8/attachment.bin>
More information about the llvm-commits
mailing list