summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-08-12 11:28:02 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-08-12 11:28:02 +0000
commitccdad6ef486a00ed815ead642d2f62d87d86ee90 (patch)
treeaa68a38cfef0a52681ff57dbbd40a8d1b48622e0 /llvm/test
parent05e8209e3347f636e93af9182c913259ec2bbffa (diff)
downloadbcm5719-llvm-ccdad6ef486a00ed815ead642d2f62d87d86ee90.tar.gz
bcm5719-llvm-ccdad6ef486a00ed815ead642d2f62d87d86ee90.zip
[InstCombine] foldShiftIntoShiftInAnotherHandOfAndInICmp(): avoid constantexpr pitfail (PR42962)
Instead of matching value and then blindly casting to BinaryOperator just to get the opcode, just match instruction and do no cast. Fixes https://bugs.llvm.org/show_bug.cgi?id=42962 llvm-svn: 368554
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
index 55d268b9b77..9a2cfa5977a 100644
--- a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
+++ b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
@@ -667,3 +667,15 @@ define <2 x i1> @n38_overshift(<2 x i32> %x, <2 x i32> %y) {
%t3 = icmp ne <2 x i32> %t2, <i32 0, i32 0>
ret <2 x i1> %t3
}
+
+; As usual, don't crash given constantexpr's :/
+@f.a = internal global i16 0
+define i1 @constantexpr() {
+entry:
+ %0 = load i16, i16* @f.a
+ %shr = ashr i16 %0, 1
+ %shr1 = ashr i16 %shr, zext (i1 icmp ne (i16 ptrtoint (i16* @f.a to i16), i16 1) to i16)
+ %and = and i16 %shr1, 1
+ %tobool = icmp ne i16 %and, 0
+ ret i1 %tobool
+}
OpenPOWER on IntegriCloud