summaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-01-14 15:26:10 +0000
committerDuncan Sands <baldrick@free.fr>2011-01-14 15:26:10 +0000
commitc087e20331c8a4c3b77d96a73588e80c06d89e3d (patch)
tree94ac52a66a86f73e2f0331a997aae1964ed3aacc /test/Transforms/InstSimplify
parentcf80bc1d4ac741620641c2bf48c25993bd478bd0 (diff)
downloadllvm-c087e20331c8a4c3b77d96a73588e80c06d89e3d.tar.gz
llvm-c087e20331c8a4c3b77d96a73588e80c06d89e3d.tar.bz2
llvm-c087e20331c8a4c3b77d96a73588e80c06d89e3d.tar.xz
Turn X-(X-Y) into Y. According to my auto-simplifier this is the most common
simplification present in fully optimized code (I think instcombine fails to transform some of these when "X-Y" has more than one use). Fires here and there all over the test-suite, for example it eliminates 8 subtractions in the final IR for 445.gobmk, 2 subs in 447.dealII, 2 in paq8p etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r--test/Transforms/InstSimplify/2010-12-20-Reassociate.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll b/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
index 87dfdda910..03d5c33f87 100644
--- a/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
+++ b/test/Transforms/InstSimplify/2010-12-20-Reassociate.ll
@@ -62,3 +62,11 @@ define i32 @xor2(i32 %x, i32 %y) {
ret i32 %l
; CHECK: ret i32 %y
}
+
+define i32 @sub1(i32 %x, i32 %y) {
+; CHECK: @sub1
+ %d = sub i32 %x, %y
+ %r = sub i32 %x, %d
+ ret i32 %r
+; CHECK: ret i32 %y
+}