aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify/compare.ll
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-10-30 19:56:36 +0000
committerDuncan Sands <baldrick@free.fr>2011-10-30 19:56:36 +0000
commit6dc9e2bf7455fa1494078d5d52f1363b05183f20 (patch)
treeaff5c15aaf9233e3f9e2fbbf718549c285be8eb6 /test/Transforms/InstSimplify/compare.ll
parent26ec44f7cf3a9b191b2cf68c6407a03cf552949a (diff)
Reapply commit 143214 with a fix: m_ICmp doesn't match conditions
with the given predicate, it matches any condition and returns the predicate - d'oh! Original commit message: The expression icmp eq (select (icmp eq x, 0), 1, x), 0 folds to false. Spotted by my super-optimizer in 186.crafty and 450.soplex. We really need a proper infrastructure for handling generalizations of this kind of thing (which occur a lot), however this case is so simple that I decided to go ahead and implement it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify/compare.ll')
-rw-r--r--test/Transforms/InstSimplify/compare.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index 57727c9ab7..db5e72f9db 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -204,6 +204,24 @@ define i1 @select4(i1 %cond) {
; CHECK: ret i1 %cond
}
+define i1 @select5(i32 %x) {
+; CHECK: @select5
+ %c = icmp eq i32 %x, 0
+ %s = select i1 %c, i32 1, i32 %x
+ %c2 = icmp eq i32 %s, 0
+ ret i1 %c2
+; CHECK: ret i1 false
+}
+
+define i1 @select6(i32 %x) {
+; CHECK: @select6
+ %c = icmp sgt i32 %x, 0
+ %s = select i1 %c, i32 %x, i32 4
+ %c2 = icmp eq i32 %s, 0
+ ret i1 %c2
+; CHECK: ret i1 %c2
+}
+
define i1 @urem1(i32 %X, i32 %Y) {
; CHECK: @urem1
%A = urem i32 %X, %Y