summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-05-14 13:43:32 +0000
committerSanjay Patel <spatel@rotateright.com>2018-05-14 13:43:32 +0000
commitbf55e6dee136d081b0858f62fcc362d74a708894 (patch)
treef9d4d6d2d7c440cde8fda1711cbc39744cfe3f3e /llvm/test
parent8f2b2f4e048522b542b5dd948acfc4eca33fd14b (diff)
downloadbcm5719-llvm-bf55e6dee136d081b0858f62fcc362d74a708894.tar.gz
bcm5719-llvm-bf55e6dee136d081b0858f62fcc362d74a708894.zip
[AggressiveInstCombine] avoid crashing on unsimplified code (PR37446)
This bug: https://bugs.llvm.org/show_bug.cgi?id=37446 ...raises another question: why do we run aggressive-instcombine before regular instcombine? llvm-svn: 332243
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll b/llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll
index e03fb338bb4..3d82fe53e6e 100644
--- a/llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll
+++ b/llvm/test/Transforms/AggressiveInstCombine/masked-cmp.ll
@@ -217,3 +217,19 @@ define i64 @allset_40_bit_mask(i64 %x) {
ret i64 %a40
}
+; Verify that unsimplified code doesn't crash:
+; https://bugs.llvm.org/show_bug.cgi?id=37446
+
+define i32 @PR37446(i32 %x) {
+; CHECK-LABEL: @PR37446(
+; CHECK-NEXT: [[SHR:%.*]] = lshr i32 1, 33
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[SHR]], 15
+; CHECK-NEXT: [[AND1:%.*]] = and i32 [[AND]], [[X:%.*]]
+; CHECK-NEXT: ret i32 [[AND1]]
+;
+ %shr = lshr i32 1, 33
+ %and = and i32 %shr, 15
+ %and1 = and i32 %and, %x
+ ret i32 %and1
+}
+
OpenPOWER on IntegriCloud