summaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-01-14 14:44:12 +0000
committerDuncan Sands <baldrick@free.fr>2011-01-14 14:44:12 +0000
commitcf80bc1d4ac741620641c2bf48c25993bd478bd0 (patch)
tree33e12d88f7d8cd3788cad49194fbfd105501dcf2 /test/Transforms/InstSimplify
parent62becca681d04ad72079b4733a96f97ba3caa109 (diff)
downloadllvm-cf80bc1d4ac741620641c2bf48c25993bd478bd0.tar.gz
llvm-cf80bc1d4ac741620641c2bf48c25993bd478bd0.tar.bz2
llvm-cf80bc1d4ac741620641c2bf48c25993bd478bd0.tar.xz
Factorize common code out of the InstructionSimplify shift logic. Add in
threading of shifts over selects and phis while there. This fires here and there in the testsuite, to not much effect. For example when compiling spirit it fires 5 times, during early-cse, resulting in 6 more cse simplifications, and 3 more terminators being folded by jump threading, but the final bitcode doesn't change in any interesting way: other optimizations would have caught the opportunity anyway, only later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r--test/Transforms/InstSimplify/2011-01-14-Thread.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/2011-01-14-Thread.ll b/test/Transforms/InstSimplify/2011-01-14-Thread.ll
new file mode 100644
index 0000000000..8fc4dc5d5b
--- /dev/null
+++ b/test/Transforms/InstSimplify/2011-01-14-Thread.ll
@@ -0,0 +1,9 @@
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+
+define i32 @shift_select(i1 %cond) {
+; CHECK: @shift_select
+ %s = select i1 %cond, i32 0, i32 1
+ %r = lshr i32 %s, 1
+ ret i32 %r
+; CHECK: ret i32 0
+}