summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CodeExtractor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 7b45b1799c4..27b982578c4 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -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;
}
OpenPOWER on IntegriCloud