summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/sub.ll
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-01-31 02:30:23 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-01-31 02:30:23 +0000
commit694488f4770468f03b974180631c0fbfa21b28cc (patch)
treeff3af0445dfed3464a6c36bf37a5f8736a12097e /test/Transforms/InstCombine/sub.ll
parent894c1af05fb3f0d8e2ee6565816fa220b260ed9d (diff)
downloadllvm-694488f4770468f03b974180631c0fbfa21b28cc.tar.gz
llvm-694488f4770468f03b974180631c0fbfa21b28cc.tar.bz2
llvm-694488f4770468f03b974180631c0fbfa21b28cc.tar.xz
Add a small transform: transform -(X<<Y) to (-X<<Y) when the shift has a single
use and X is free to negate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/sub.ll')
-rw-r--r--test/Transforms/InstCombine/sub.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll
index fa0322a44e..29bd7be2ff 100644
--- a/test/Transforms/InstCombine/sub.ll
+++ b/test/Transforms/InstCombine/sub.ll
@@ -272,4 +272,12 @@ define i64 @test25(i8* %P, i64 %A){
; CHECK-NEXT: ret i64
}
+define i32 @test26(i32 %x) {
+ %shl = shl i32 3, %x
+ %neg = sub i32 0, %shl
+ ret i32 %neg
+; CHECK: @test26
+; CHECK-NEXT: shl i32 -3
+; CHECK-NEXT: ret i32
+}