diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-09-27 07:38:41 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-09-27 07:38:41 +0000 |
commit | c94270c382320cb3fe9c4dc7bf31d56c94e9643d (patch) | |
tree | 4c1c1178faea69663c9960feb71cf5c5e5e39ff4 /lib/Transforms/Scalar | |
parent | ebb9633af0245a3eaf03d2a9f4ceb6375cc8769e (diff) | |
download | external_llvm-c94270c382320cb3fe9c4dc7bf31d56c94e9643d.zip external_llvm-c94270c382320cb3fe9c4dc7bf31d56c94e9643d.tar.gz external_llvm-c94270c382320cb3fe9c4dc7bf31d56c94e9643d.tar.bz2 |
Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LICM.cpp | 7 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/TailDuplication.cpp | 2 |
7 files changed, 8 insertions, 13 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index a2d210a..f490a6d 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -2059,7 +2059,7 @@ bool GVN::performPRE(Function& F) { // will be available in the predecessor by the time we need them. Any // that weren't original present will have been instantiated earlier // in this loop. - Instruction *PREInstr = CurInst->clone(CurInst->getContext()); + Instruction *PREInstr = CurInst->clone(); bool success = true; for (unsigned i = 0, e = CurInst->getNumOperands(); i != e; ++i) { Value *Op = PREInstr->getOperand(i); diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 158b0d7..e2d9e0b 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -292,7 +292,7 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L, if (NumPreds != 1) { // Clone the PHI and delete the original one. This lets IVUsers and // any other maps purge the original user from their records. - PHINode *NewPN = PN->clone(PN->getContext()); + PHINode *NewPN = PN->clone(); NewPN->takeName(PN); NewPN->insertBefore(PN); PN->replaceAllUsesWith(NewPN); diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index 559b8cb..21b6ceb 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -934,7 +934,7 @@ bool JumpThreading::ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, // Clone the non-phi instructions of BB into NewBB, keeping track of the // mapping and using it to remap operands in the cloned instructions. for (; !isa<TerminatorInst>(BI); ++BI) { - Instruction *New = BI->clone(BI->getContext()); + Instruction *New = BI->clone(); New->setName(BI->getName()); NewBB->getInstList().push_back(New); ValueMapping[BI] = New; diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 1c29878..fe37ab4 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -36,7 +36,6 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" -#include "llvm/LLVMContext.h" #include "llvm/Target/TargetData.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" @@ -476,8 +475,6 @@ void LICM::sink(Instruction &I) { ++NumSunk; Changed = true; - LLVMContext &Context = I.getContext(); - // The case where there is only a single exit node of this loop is common // enough that we handle it as a special (more efficient) case. It is more // efficient to handle because there are no PHI nodes that need to be placed. @@ -573,7 +570,7 @@ void LICM::sink(Instruction &I) { ExitBlock->getInstList().insert(InsertPt, &I); New = &I; } else { - New = I.clone(Context); + New = I.clone(); CurAST->copyValue(&I, New); if (!I.getName().empty()) New->setName(I.getName()+".le"); @@ -596,7 +593,7 @@ void LICM::sink(Instruction &I) { if (AI) { std::vector<AllocaInst*> Allocas; Allocas.push_back(AI); - PromoteMemToReg(Allocas, *DT, *DF, Context, CurAST); + PromoteMemToReg(Allocas, *DT, *DF, I.getContext(), CurAST); } } } diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index ca394bd..34ba48c 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -237,7 +237,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { // This is not a PHI instruction. Insert its clone into original pre-header. // If this instruction is using a value from same basic block then // update it to use value from cloned instruction. - Instruction *C = In->clone(In->getContext()); + Instruction *C = In->clone(); C->setName(In->getName()); OrigPreHeader->getInstList().push_back(C); diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 82eb14f..d8f6cc1 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -24,7 +24,6 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" -#include "llvm/LLVMContext.h" #include "llvm/Type.h" #include "llvm/DerivedTypes.h" #include "llvm/Analysis/Dominators.h" @@ -2303,7 +2302,6 @@ void LoopStrengthReduce::OptimizeLoopTermCond(Loop *L) { // one register value. BasicBlock *LatchBlock = L->getLoopLatch(); BasicBlock *ExitingBlock = L->getExitingBlock(); - LLVMContext &Context = LatchBlock->getContext(); if (!ExitingBlock) // Multiple exits, just look at the exit in the latch block if there is one. @@ -2394,7 +2392,7 @@ void LoopStrengthReduce::OptimizeLoopTermCond(Loop *L) { Cond->moveBefore(TermBr); } else { // Otherwise, clone the terminating condition and insert into the loopend. - Cond = cast<ICmpInst>(Cond->clone(Context)); + Cond = cast<ICmpInst>(Cond->clone()); Cond->setName(L->getHeader()->getName() + ".termcond"); LatchBlock->getInstList().insert(TermBr, Cond); diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 8345175..ee45231 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -306,7 +306,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) { // keeping track of the mapping... // for (; BI != DestBlock->end(); ++BI) { - Instruction *New = BI->clone(BI->getContext()); + Instruction *New = BI->clone(); New->setName(BI->getName()); SourceBlock->getInstList().push_back(New); ValueMapping[BI] = New; |