[llvm-branch-commits] [llvm-branch] r226854 - Merging r226708:
Hans Wennborg
hans at hanshq.net
Thu Jan 22 11:40:47 PST 2015
Author: hans
Date: Thu Jan 22 13:40:47 2015
New Revision: 226854
URL: http://llvm.org/viewvc/llvm-project?rev=226854&view=rev
Log:
Merging r226708:
------------------------------------------------------------------------
r226708 | majnemer | 2015-01-21 14:32:04 -0800 (Wed, 21 Jan 2015) | 4 lines
InstCombine: Don't strip bitcasts off of callsites marked 'thunk'
The return type of a thunk is meaningless, we just want the arguments
and return value to be forwarded.
------------------------------------------------------------------------
Modified:
llvm/branches/release_36/ (props changed)
llvm/branches/release_36/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/branches/release_36/test/Transforms/InstCombine/call-cast-target.ll
Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 22 13:40:47 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226755
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226708,226755
Modified: llvm/branches/release_36/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=226854&r1=226853&r2=226854&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/branches/release_36/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Jan 22 13:40:47 2015
@@ -1376,6 +1376,10 @@ bool InstCombiner::transformConstExprCas
dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts());
if (!Callee)
return false;
+ // The prototype of thunks are a lie, don't try to directly call such
+ // functions.
+ if (Callee->hasFnAttribute("thunk"))
+ return false;
Instruction *Caller = CS.getInstruction();
const AttributeSet &CallerPAL = CS.getAttributes();
Modified: llvm/branches/release_36/test/Transforms/InstCombine/call-cast-target.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/test/Transforms/InstCombine/call-cast-target.ll?rev=226854&r1=226853&r2=226854&view=diff
==============================================================================
--- llvm/branches/release_36/test/Transforms/InstCombine/call-cast-target.ll (original)
+++ llvm/branches/release_36/test/Transforms/InstCombine/call-cast-target.ll Thu Jan 22 13:40:47 2015
@@ -61,3 +61,14 @@ 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
+}
More information about the llvm-branch-commits
mailing list