mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Fix bug: 2003-10-29-CallSiteResolve.ll & PR70
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1758d4d863
commit
bb60904469
@ -1739,7 +1739,17 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
if (Caller->getType() != NV->getType() && !Caller->use_empty()) {
|
if (Caller->getType() != NV->getType() && !Caller->use_empty()) {
|
||||||
if (NV->getType() != Type::VoidTy) {
|
if (NV->getType() != Type::VoidTy) {
|
||||||
NV = NC = new CastInst(NC, Caller->getType(), "tmp");
|
NV = NC = new CastInst(NC, Caller->getType(), "tmp");
|
||||||
InsertNewInstBefore(NC, *Caller);
|
|
||||||
|
// If this is an invoke instruction, we should insert it after the first
|
||||||
|
// non-phi, instruction in the normal successor block.
|
||||||
|
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
|
||||||
|
BasicBlock::iterator I = II->getNormalDest()->begin();
|
||||||
|
while (isa<PHINode>(I)) ++I;
|
||||||
|
InsertNewInstBefore(NC, *I);
|
||||||
|
} else {
|
||||||
|
// Otherwise, it's a call, just insert cast right after the call instr
|
||||||
|
InsertNewInstBefore(NC, *Caller);
|
||||||
|
}
|
||||||
AddUsesToWorkList(*Caller);
|
AddUsesToWorkList(*Caller);
|
||||||
} else {
|
} else {
|
||||||
NV = Constant::getNullValue(Caller->getType());
|
NV = Constant::getNullValue(Caller->getType());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user