summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-31 05:14:34 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-31 05:14:34 +0000
commit56df0ec61033a5bb49b3620e70cc6a61e26b3e7a (patch)
tree5a2e2fe08b8e20bc2b51e882099704fc51e0d0d0 /llvm/test
parentc9d6d8b106270aca855e6b4bb307db9c13c298a5 (diff)
downloadbcm5719-llvm-56df0ec61033a5bb49b3620e70cc6a61e26b3e7a.tar.gz
bcm5719-llvm-56df0ec61033a5bb49b3620e70cc6a61e26b3e7a.zip
[InstCombine] Fix incorrect rule from rL236202
The rule for SMIN introduced in rL236202 doesn't work as advertised: the check for Pred == ICmpInst::ICMP_SGT was missing. llvm-svn: 264996
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/select.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll
index 7df3ba01998..876999b95dc 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -1589,3 +1589,21 @@ define i32 @PR23757(i32 %x) {
%sel = select i1 %cmp, i32 -2147483648, i32 %add
ret i32 %sel
}
+
+
+define i32 @PR27137(i32 %a) {
+; CHECK-LABEL: @PR27137(
+; CHECK-NEXT: %not_a = xor i32 %a, -1
+; CHECK-NEXT: %c0 = icmp slt i32 %a, 0
+; CHECK-NEXT: %s0 = select i1 %c0, i32 %not_a, i32 -1
+; CHECK-NEXT: %c1 = icmp sgt i32 %s0, -1
+; CHECK-NEXT: %s1 = select i1 %c1, i32 %s0, i32 -1
+; CHECK-NEXT: ret i32 %s1
+
+ %not_a = xor i32 %a, -1
+ %c0 = icmp slt i32 %a, 0
+ %s0 = select i1 %c0, i32 %not_a, i32 -1
+ %c1 = icmp sgt i32 %s0, -1
+ %s1 = select i1 %c1, i32 %s0, i32 -1
+ ret i32 %s1
+}
OpenPOWER on IntegriCloud