[TI removal] Update CodeExtractor to use Instruction directly.

llvm-svn: 344716
This commit is contained in:
Chandler Carruth 2018-10-18 00:38:54 +00:00
parent c1e3ee29a4
commit 8b7a8123dd
1 changed files with 4 additions and 4 deletions

View File

@ -808,10 +808,10 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs,
for (unsigned i = 0, e = Users.size(); i != e; ++i)
// The BasicBlock which contains the branch is not in the region
// modify the branch target to a new block
if (TerminatorInst *TI = dyn_cast<TerminatorInst>(Users[i]))
if (!Blocks.count(TI->getParent()) &&
TI->getParent()->getParent() == oldFunction)
TI->replaceUsesOfWith(header, newHeader);
if (Instruction *I = dyn_cast<Instruction>(Users[i]))
if (I->isTerminator() && !Blocks.count(I->getParent()) &&
I->getParent()->getParent() == oldFunction)
I->replaceUsesOfWith(header, newHeader);
return newFunction;
}