summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/shift.ll
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2012-12-04 22:15:32 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2012-12-04 22:15:32 +0000
commita09e18fcfab0e998526724357f8fc5ef7f4c3e7a (patch)
treeae8edcd6a6d4c443904d32759291fe09ec4815f8 /test/Transforms/InstCombine/shift.ll
parent836cfc46b38969acc2f74af099b51d0b567f498d (diff)
downloadllvm-a09e18fcfab0e998526724357f8fc5ef7f4c3e7a.tar.gz
llvm-a09e18fcfab0e998526724357f8fc5ef7f4c3e7a.tar.bz2
llvm-a09e18fcfab0e998526724357f8fc5ef7f4c3e7a.tar.xz
For rdar://12329730, last piece.
This change attempts to simplify (X^Y) -> X or Y in the user's context if we know that only bits from X or Y are demanded. A minimized case is provided bellow. This change will simplify "t>>16" into "var1 >>16". ============================================================= unsigned foo (unsigned val1, unsigned val2) { unsigned t = val1 ^ 1234; return (t >> 16) | t; // NOTE: t is used more than once. } ============================================================= Note that if the "t" were used only once, the expression would be finally optimized as well. However, with with this change, the optimization will take place earlier. Reviewed by Nadav, Thanks a lot! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/shift.ll')
-rw-r--r--test/Transforms/InstCombine/shift.ll4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index fad0bd7ede..32867761a3 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -523,9 +523,9 @@ entry:
%tmp51 = xor i8 %tmp50, %tmp5
%tmp52 = and i8 %tmp51, -128
%tmp53 = lshr i8 %tmp52, 7
-; CHECK: lshr i8 %tmp51, 7
%tmp54 = mul i8 %tmp53, 16
-; CHECK: shl nuw nsw i8 %tmp53, 4
+; CHECK: %0 = shl i8 %tmp4, 2
+; CHECK: %tmp54 = and i8 %0, 16
%tmp55 = xor i8 %tmp54, %tmp51
; CHECK: ret i8 %tmp551
ret i8 %tmp55