diff options
author | Stephen Hines <srhines@google.com> | 2015-04-01 18:49:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-01 18:49:26 +0000 |
commit | 3fa16bd6062e23bcdb82ed4dd965674792e6b761 (patch) | |
tree | 9348fc507292f7e8715d22d64ce5a32131b4f875 /test/Transforms/InstCombine/call-cast-target.ll | |
parent | beed47390a60f6f0c77532b3d3f76bb47ef49423 (diff) | |
parent | ebe69fe11e48d322045d5949c83283927a0d790b (diff) | |
download | external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.zip external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.gz external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.bz2 |
Merge "Update aosp/master LLVM for rebase to r230699."
Diffstat (limited to 'test/Transforms/InstCombine/call-cast-target.ll')
-rw-r--r-- | test/Transforms/InstCombine/call-cast-target.ll | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/call-cast-target.ll b/test/Transforms/InstCombine/call-cast-target.ll index 1af3317..4a5c949 100644 --- a/test/Transforms/InstCombine/call-cast-target.ll +++ b/test/Transforms/InstCombine/call-cast-target.ll @@ -5,7 +5,9 @@ target triple = "i686-pc-linux-gnu" define i32 @main() { ; CHECK-LABEL: @main -; CHECK: call i32 bitcast +; CHECK: %[[call:.*]] = call i8* @ctime(i32* null) +; CHECK: %[[cast:.*]] = ptrtoint i8* %[[call]] to i32 +; CHECK: ret i32 %[[cast]] entry: %tmp = call i32 bitcast (i8* (i32*)* @ctime to i32 (i32*)*)( i32* null ) ; <i32> [#uses=1] ret i32 %tmp @@ -25,3 +27,48 @@ entry: %0 = call { i8 } bitcast ({ i8 } (i32*)* @foo to { i8 } (i16*)*)(i16* null) ret void } + +declare i32 @fn1(i32) + +define i32 @test1(i32* %a) { +; CHECK-LABEL: @test1 +; CHECK: %[[cast:.*]] = ptrtoint i32* %a to i32 +; CHECK-NEXT: %[[call:.*]] = tail call i32 @fn1(i32 %[[cast]]) +; CHECK-NEXT: ret i32 %[[call]] +entry: + %call = tail call i32 bitcast (i32 (i32)* @fn1 to i32 (i32*)*)(i32* %a) + ret i32 %call +} + +declare i32 @fn2(i16) + +define i32 @test2(i32* %a) { +; CHECK-LABEL: @test2 +; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i16)* @fn2 to i32 (i32*)*)(i32* %a) +; CHECK-NEXT: ret i32 %[[call]] +entry: + %call = tail call i32 bitcast (i32 (i16)* @fn2 to i32 (i32*)*)(i32* %a) + ret i32 %call +} + +declare i32 @fn3(i64) + +define i32 @test3(i32* %a) { +; CHECK-LABEL: @test3 +; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i64)* @fn3 to i32 (i32*)*)(i32* %a) +; CHECK-NEXT: ret i32 %[[call]] +entry: + %call = tail call i32 bitcast (i32 (i64)* @fn3 to i32 (i32*)*)(i32* %a) + ret i32 %call +} + +declare i32 @fn4(i32) "thunk" + +define i32 @test4(i32* %a) { +; CHECK-LABEL: @test4 +; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i32)* @fn4 to i32 (i32*)*)(i32* %a) +; CHECK-NEXT: ret i32 %[[call]] +entry: + %call = tail call i32 bitcast (i32 (i32)* @fn4 to i32 (i32*)*)(i32* %a) + ret i32 %call +} |