From edb12a838a22f212d7bee970ff637192f7ea8576 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 15 Oct 2018 10:04:59 +0000 Subject: [TI removal] Make variables declared as `TerminatorInst` and initialized by `getTerminator()` calls instead be declared as `Instruction`. This is the biggest remaining chunk of the usage of `getTerminator()` that insists on the narrow type and so is an easy batch of updates. Several files saw more extensive updates where this would cascade to requiring API updates within the file to use `Instruction` instead of `TerminatorInst`. All of these were trivial in nature (pervasively using `Instruction` instead just worked). llvm-svn: 344502 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Utils/CodeExtractor.cpp') diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index 7f26c53ecf3..0e9e3219033 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -566,7 +566,7 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) { // changing them to branch to NewBB instead. for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (Blocks.count(PN->getIncomingBlock(i))) { - TerminatorInst *TI = PN->getIncomingBlock(i)->getTerminator(); + Instruction *TI = PN->getIncomingBlock(i)->getTerminator(); TI->replaceUsesOfWith(OldPred, NewBB); } @@ -778,7 +778,7 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs, Value *Idx[2]; Idx[0] = Constant::getNullValue(Type::getInt32Ty(header->getContext())); Idx[1] = ConstantInt::get(Type::getInt32Ty(header->getContext()), i); - TerminatorInst *TI = newFunction->begin()->getTerminator(); + Instruction *TI = newFunction->begin()->getTerminator(); GetElementPtrInst *GEP = GetElementPtrInst::Create( StructTy, &*AI, Idx, "gep_" + inputs[i]->getName(), TI); RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI); @@ -972,7 +972,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, unsigned switchVal = 0; for (BasicBlock *Block : Blocks) { - TerminatorInst *TI = Block->getTerminator(); + Instruction *TI = Block->getTerminator(); for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) if (!Blocks.count(TI->getSuccessor(i))) { BasicBlock *OldTarget = TI->getSuccessor(i); @@ -1078,7 +1078,7 @@ void CodeExtractor::calculateNewCallTerminatorWeights( using BlockNode = BlockFrequencyInfoImplBase::BlockNode; // Update the branch weights for the exit block. - TerminatorInst *TI = CodeReplacer->getTerminator(); + Instruction *TI = CodeReplacer->getTerminator(); SmallVector BranchWeights(TI->getNumSuccessors(), 0); // Block Frequency distribution with dummy node. -- cgit v1.2.3