summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/cast.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-10 02:22:12 +0000
committerChris Lattner <sabre@nondot.org>2010-01-10 02:22:12 +0000
commitd26c9e183e56d09f48d7074be4cacce099338316 (patch)
treeb46bcf64ab43a254e8a455e9c8b09eb570cf5951 /test/Transforms/InstCombine/cast.ll
parent3f7dc880c4b558655cb8868ce29e1d2b27e2ea51 (diff)
downloadllvm-d26c9e183e56d09f48d7074be4cacce099338316.tar.gz
llvm-d26c9e183e56d09f48d7074be4cacce099338316.tar.bz2
llvm-d26c9e183e56d09f48d7074be4cacce099338316.tar.xz
enhance CanEvaluateZExtd to handle shift left and sext, allowing
more expressions to be promoted and casts eliminated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93096 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/cast.ll')
-rw-r--r--test/Transforms/InstCombine/cast.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
index b6dc4642b8..490df8fab6 100644
--- a/test/Transforms/InstCombine/cast.ll
+++ b/test/Transforms/InstCombine/cast.ll
@@ -403,3 +403,31 @@ define i64 @test44(i8 %T) {
; CHECK-NEXT: %B = or i64 %A, 1234
; CHECK-NEXT: ret i64 %B
}
+
+define i64 @test45(i8 %A, i64 %Q) {
+ %D = trunc i64 %Q to i32 ;; should be removed
+ %B = sext i8 %A to i32
+ %C = or i32 %B, %D
+ %E = zext i32 %C to i64
+ ret i64 %E
+; CHECK: @test45
+; CHECK-NEXT: %B = sext i8 %A to i64
+; CHECK-NEXT: %C = or i64 %B, %Q
+; CHECK-NEXT: %E = and i64 %C, 4294967295
+; CHECK-NEXT: ret i64 %E
+}
+
+
+define i64 @test46(i64 %A) {
+ %B = trunc i64 %A to i32
+ %C = and i32 %B, 42
+ %D = shl i32 %C, 8
+ %E = zext i32 %D to i64
+ ret i64 %E
+; CHECK: @test46
+; CHECK-NEXT: %C = shl i64 %A, 8
+; CHECK-NEXT: %D = and i64 %C, 10752
+; CHECK-NEXT: ret i64 %D
+}
+
+