mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
and also update the cloning interface's major user, the loop optimizations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48088 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -33,6 +33,7 @@ BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB,
|
||||
ClonedCodeInfo *CodeInfo) {
|
||||
BasicBlock *NewBB = new BasicBlock("", F);
|
||||
if (BB->hasName()) NewBB->setName(BB->getName()+NameSuffix);
|
||||
NewBB->setUnwindDest(const_cast<BasicBlock*>(BB->getUnwindDest()));
|
||||
|
||||
bool hasCalls = false, hasDynamicAllocas = false, hasStaticAllocas = false;
|
||||
|
||||
@ -103,10 +104,15 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
|
||||
// references as we go. This uses ValueMap to do all the hard work.
|
||||
//
|
||||
for (Function::iterator BB = cast<BasicBlock>(ValueMap[OldFunc->begin()]),
|
||||
BE = NewFunc->end(); BB != BE; ++BB)
|
||||
BE = NewFunc->end(); BB != BE; ++BB) {
|
||||
// Fix up the unwind_to label.
|
||||
if (BasicBlock *UnwindDest = BB->getUnwindDest())
|
||||
BB->setUnwindDest(cast<BasicBlock>(ValueMap[UnwindDest]));
|
||||
|
||||
// Loop over all instructions, fixing each one as we find it...
|
||||
for (BasicBlock::iterator II = BB->begin(); II != BB->end(); ++II)
|
||||
RemapInstruction(II, ValueMap);
|
||||
}
|
||||
}
|
||||
|
||||
/// CloneFunction - Return a copy of the specified function, but without
|
||||
|
Reference in New Issue
Block a user