diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-08-13 21:49:33 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-08-13 21:49:33 +0000 |
commit | 93f7e7f03e28e80f25cdce02fbd15fb3394983e6 (patch) | |
tree | f8bb540e2b40f9359d6d3ac6bb9cbb5b4f202268 | |
parent | 15bff18c6f2c1e68f9b25110824e384115925461 (diff) | |
download | llvm-93f7e7f03e28e80f25cdce02fbd15fb3394983e6.zip llvm-93f7e7f03e28e80f25cdce02fbd15fb3394983e6.tar.gz llvm-93f7e7f03e28e80f25cdce02fbd15fb3394983e6.tar.bz2 |
[NFC][InstCombine] Add a test for D50465 that used to assert
This is valid to fold, too.
https://rise4fun.com/Alive/0lz
llvm-svn: 339619
-rw-r--r-- | llvm/test/Transforms/InstCombine/signed-truncation-check.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/signed-truncation-check.ll b/llvm/test/Transforms/InstCombine/signed-truncation-check.ll index 66f04d5e..37de08b 100644 --- a/llvm/test/Transforms/InstCombine/signed-truncation-check.ll +++ b/llvm/test/Transforms/InstCombine/signed-truncation-check.ll @@ -101,6 +101,25 @@ define i1 @positive_with_aggressive_icmp(i32 %arg) { ; I'm sure there is a bunch more patterns possible :/ +; This used to trigger an assert, because the icmp's are not direct +; operands of the and. +define i1 @positive_with_extra_and(i32 %arg, i1 %z) { +; CHECK-LABEL: @positive_with_extra_and( +; CHECK-NEXT: [[T1:%.*]] = icmp sgt i32 [[ARG:%.*]], -1 +; CHECK-NEXT: [[T2:%.*]] = add i32 [[ARG]], 128 +; CHECK-NEXT: [[T3:%.*]] = icmp ult i32 [[T2]], 256 +; CHECK-NEXT: [[T4:%.*]] = and i1 [[T1]], [[Z:%.*]] +; CHECK-NEXT: [[T5:%.*]] = and i1 [[T3]], [[T4]] +; CHECK-NEXT: ret i1 [[T5]] +; + %t1 = icmp sgt i32 %arg, -1 + %t2 = add i32 %arg, 128 + %t3 = icmp ult i32 %t2, 256 + %t4 = and i1 %t1, %z + %t5 = and i1 %t3, %t4 + ret i1 %t5 +} + ; ============================================================================ ; ; Vector tests ; ============================================================================ ; |