diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-01-21 22:32:04 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-01-21 22:32:04 +0000 |
commit | 4c0a6e918a0b53466bf886aab573b999e4c26207 (patch) | |
tree | c0f82eb7f8a13fe458e583de25cf281cf6715988 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | 9da94483395fa1023a577be19811a250666cd7cd (diff) | |
download | bcm5719-llvm-4c0a6e918a0b53466bf886aab573b999e4c26207.tar.gz bcm5719-llvm-4c0a6e918a0b53466bf886aab573b999e4c26207.zip |
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.
llvm-svn: 226708
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 40f288c175c..0223d69ab57 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1381,6 +1381,10 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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(); |