[llvm-commits] [llvm] r82889 - in /llvm/trunk: include/llvm/ lib/Transforms/Instrumentation/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/
Nick Lewycky
nicholas at mxc.ca
Sun Sep 27 00:38:41 PDT 2009
Author: nicholas
Date: Sun Sep 27 02:38:41 2009
New Revision: 82889
URL: http://llvm.org/viewvc/llvm-project?rev=82889&view=rev
Log:
Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.
Modified:
llvm/trunk/include/llvm/InstrTypes.h
llvm/trunk/include/llvm/Instruction.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Sun Sep 27 02:38:41 2009
@@ -53,7 +53,7 @@
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
public:
- virtual TerminatorInst *clone(LLVMContext &Context) const = 0;
+ virtual TerminatorInst *clone() const = 0;
/// getNumSuccessors - Return the number of successors that this terminator
/// has.
@@ -299,7 +299,7 @@
return static_cast<BinaryOps>(Instruction::getOpcode());
}
- virtual BinaryOperator *clone(LLVMContext &Context) const;
+ virtual BinaryOperator *clone() const;
/// swapOperands - Exchange the two operands to this instruction.
/// This instruction is safe to use on any binary instruction and
Modified: llvm/trunk/include/llvm/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instruction.h (original)
+++ llvm/trunk/include/llvm/Instruction.h Sun Sep 27 02:38:41 2009
@@ -47,7 +47,7 @@
/// * The instruction has no parent
/// * The instruction has no name
///
- virtual Instruction *clone(LLVMContext &Context) const = 0;
+ virtual Instruction *clone() const = 0;
/// isIdenticalTo - Return true if the specified instruction is exactly
/// identical to the current one. This means that all operands match and any
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Sun Sep 27 02:38:41 2009
@@ -80,7 +80,7 @@
unsigned getAlignment() const { return (1u << SubclassData) >> 1; }
void setAlignment(unsigned Align);
- virtual AllocationInst *clone(LLVMContext &Context) const = 0;
+ virtual AllocationInst *clone() const = 0;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const AllocationInst *) { return true; }
@@ -129,7 +129,7 @@
: AllocationInst(Ty, ArraySize,
Malloc, Align, NameStr, InsertBefore) {}
- virtual MallocInst *clone(LLVMContext &Context) const;
+ virtual MallocInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MallocInst *) { return true; }
@@ -179,7 +179,7 @@
: AllocationInst(Ty, ArraySize, Alloca,
Align, NameStr, InsertAtEnd) {}
- virtual AllocaInst *clone(LLVMContext &Context) const;
+ virtual AllocaInst *clone() const;
/// isStaticAlloca - Return true if this alloca is in the entry block of the
/// function and is a constant size. If so, the code generator will fold it
@@ -209,7 +209,7 @@
explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
FreeInst(Value *Ptr, BasicBlock *InsertAfter);
- virtual FreeInst *clone(LLVMContext &Context) const;
+ virtual FreeInst *clone() const;
// Accessor methods for consistency with other memory operations
Value *getPointerOperand() { return getOperand(0); }
@@ -265,7 +265,7 @@
SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
}
- virtual LoadInst *clone(LLVMContext &Context) const;
+ virtual LoadInst *clone() const;
/// getAlignment - Return the alignment of the access that is being performed
///
@@ -342,7 +342,7 @@
void setAlignment(unsigned Align);
- virtual StoreInst *clone(LLVMContext &Context) const;
+ virtual StoreInst *clone() const;
Value *getPointerOperand() { return getOperand(1); }
const Value *getPointerOperand() const { return getOperand(1); }
@@ -525,7 +525,7 @@
return GEP;
}
- virtual GetElementPtrInst *clone(LLVMContext &Context) const;
+ virtual GetElementPtrInst *clone() const;
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -822,7 +822,7 @@
Op<0>().swap(Op<1>());
}
- virtual ICmpInst *clone(LLVMContext &Context) const;
+ virtual ICmpInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ICmpInst *) { return true; }
@@ -931,7 +931,7 @@
Op<0>().swap(Op<1>());
}
- virtual FCmpInst *clone(LLVMContext &Context) const;
+ virtual FCmpInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FCmpInst *) { return true; }
@@ -1053,7 +1053,7 @@
SubclassData = (SubclassData & ~1) | unsigned(isTC);
}
- virtual CallInst *clone(LLVMContext &Context) const;
+ virtual CallInst *clone() const;
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1247,7 +1247,7 @@
return static_cast<OtherOps>(Instruction::getOpcode());
}
- virtual SelectInst *clone(LLVMContext &Context) const;
+ virtual SelectInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SelectInst *) { return true; }
@@ -1285,7 +1285,7 @@
setName(NameStr);
}
- virtual VAArgInst *clone(LLVMContext &Context) const;
+ virtual VAArgInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const VAArgInst *) { return true; }
@@ -1325,7 +1325,7 @@
/// formed with the specified operands.
static bool isValidOperands(const Value *Vec, const Value *Idx);
- virtual ExtractElementInst *clone(LLVMContext &Context) const;
+ virtual ExtractElementInst *clone() const;
Value *getVectorOperand() { return Op<0>(); }
Value *getIndexOperand() { return Op<1>(); }
@@ -1386,7 +1386,7 @@
static bool isValidOperands(const Value *Vec, const Value *NewElt,
const Value *Idx);
- virtual InsertElementInst *clone(LLVMContext &Context) const;
+ virtual InsertElementInst *clone() const;
/// getType - Overload to return most specific vector type.
///
@@ -1437,7 +1437,7 @@
static bool isValidOperands(const Value *V1, const Value *V2,
const Value *Mask);
- virtual ShuffleVectorInst *clone(LLVMContext &Context) const;
+ virtual ShuffleVectorInst *clone() const;
/// getType - Overload to return most specific vector type.
///
@@ -1581,7 +1581,7 @@
return new ExtractValueInst(Agg, Idxs, Idxs + 1, NameStr, InsertAtEnd);
}
- virtual ExtractValueInst *clone(LLVMContext &Context) const;
+ virtual ExtractValueInst *clone() const;
/// getIndexedType - Returns the type of the element that would be extracted
/// with an extractvalue instruction with the specified parameters.
@@ -1751,7 +1751,7 @@
return new InsertValueInst(Agg, Val, Idx, NameStr, InsertAtEnd);
}
- virtual InsertValueInst *clone(LLVMContext &Context) const;
+ virtual InsertValueInst *clone() const;
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1880,7 +1880,7 @@
resizeOperands(NumValues*2);
}
- virtual PHINode *clone(LLVMContext &Context) const;
+ virtual PHINode *clone() const;
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2047,7 +2047,7 @@
}
virtual ~ReturnInst();
- virtual ReturnInst *clone(LLVMContext &Context) const;
+ virtual ReturnInst *clone() const;
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2129,7 +2129,7 @@
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
- virtual BranchInst *clone(LLVMContext &Context) const;
+ virtual BranchInst *clone() const;
bool isUnconditional() const { return getNumOperands() == 1; }
bool isConditional() const { return getNumOperands() == 3; }
@@ -2299,7 +2299,7 @@
///
void removeCase(unsigned idx);
- virtual SwitchInst *clone(LLVMContext &Context) const;
+ virtual SwitchInst *clone() const;
unsigned getNumSuccessors() const { return getNumOperands()/2; }
BasicBlock *getSuccessor(unsigned idx) const {
@@ -2413,7 +2413,7 @@
Values, NameStr, InsertAtEnd);
}
- virtual InvokeInst *clone(LLVMContext &Context) const;
+ virtual InvokeInst *clone() const;
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2603,7 +2603,7 @@
explicit UnwindInst(LLVMContext &C, Instruction *InsertBefore = 0);
explicit UnwindInst(LLVMContext &C, BasicBlock *InsertAtEnd);
- virtual UnwindInst *clone(LLVMContext &Context) const;
+ virtual UnwindInst *clone() const;
unsigned getNumSuccessors() const { return 0; }
@@ -2640,7 +2640,7 @@
explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = 0);
explicit UnreachableInst(LLVMContext &C, BasicBlock *InsertAtEnd);
- virtual UnreachableInst *clone(LLVMContext &Context) const;
+ virtual UnreachableInst *clone() const;
unsigned getNumSuccessors() const { return 0; }
@@ -2682,7 +2682,7 @@
);
/// @brief Clone an identical TruncInst
- virtual TruncInst *clone(LLVMContext &Context) const;
+ virtual TruncInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const TruncInst *) { return true; }
@@ -2718,7 +2718,7 @@
);
/// @brief Clone an identical ZExtInst
- virtual ZExtInst *clone(LLVMContext &Context) const;
+ virtual ZExtInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ZExtInst *) { return true; }
@@ -2754,7 +2754,7 @@
);
/// @brief Clone an identical SExtInst
- virtual SExtInst *clone(LLVMContext &Context) const;
+ virtual SExtInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SExtInst *) { return true; }
@@ -2790,7 +2790,7 @@
);
/// @brief Clone an identical FPTruncInst
- virtual FPTruncInst *clone(LLVMContext &Context) const;
+ virtual FPTruncInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPTruncInst *) { return true; }
@@ -2826,7 +2826,7 @@
);
/// @brief Clone an identical FPExtInst
- virtual FPExtInst *clone(LLVMContext &Context) const;
+ virtual FPExtInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPExtInst *) { return true; }
@@ -2862,7 +2862,7 @@
);
/// @brief Clone an identical UIToFPInst
- virtual UIToFPInst *clone(LLVMContext &Context) const;
+ virtual UIToFPInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const UIToFPInst *) { return true; }
@@ -2898,7 +2898,7 @@
);
/// @brief Clone an identical SIToFPInst
- virtual SIToFPInst *clone(LLVMContext &Context) const;
+ virtual SIToFPInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SIToFPInst *) { return true; }
@@ -2934,7 +2934,7 @@
);
/// @brief Clone an identical FPToUIInst
- virtual FPToUIInst *clone(LLVMContext &Context) const;
+ virtual FPToUIInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToUIInst *) { return true; }
@@ -2970,7 +2970,7 @@
);
/// @brief Clone an identical FPToSIInst
- virtual FPToSIInst *clone(LLVMContext &Context) const;
+ virtual FPToSIInst *clone() const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToSIInst *) { return true; }
@@ -3006,7 +3006,7 @@
);
/// @brief Clone an identical IntToPtrInst
- virtual IntToPtrInst *clone(LLVMContext &Context) const;
+ virtual IntToPtrInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntToPtrInst *) { return true; }
@@ -3042,7 +3042,7 @@
);
/// @brief Clone an identical PtrToIntInst
- virtual PtrToIntInst *clone(LLVMContext &Context) const;
+ virtual PtrToIntInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const PtrToIntInst *) { return true; }
@@ -3078,7 +3078,7 @@
);
/// @brief Clone an identical BitCastInst
- virtual BitCastInst *clone(LLVMContext &Context) const;
+ virtual BitCastInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BitCastInst *) { return true; }
Modified: llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/RSProfiling.cpp Sun Sep 27 02:38:41 2009
@@ -397,7 +397,7 @@
return i;
} else {
//translate this
- Instruction* i2 = i->clone(v->getContext());
+ Instruction* i2 = i->clone();
if (i->hasName())
i2->setName("dup_" + i->getName());
TransCache[i] = i2;
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Sun Sep 27 02:38:41 2009
@@ -2059,7 +2059,7 @@
// 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);
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sun Sep 27 02:38:41 2009
@@ -292,7 +292,7 @@
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);
Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Sun Sep 27 02:38:41 2009
@@ -934,7 +934,7 @@
// 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;
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sun Sep 27 02:38:41 2009
@@ -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 @@
++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 @@
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 @@
if (AI) {
std::vector<AllocaInst*> Allocas;
Allocas.push_back(AI);
- PromoteMemToReg(Allocas, *DT, *DF, Context, CurAST);
+ PromoteMemToReg(Allocas, *DT, *DF, I.getContext(), CurAST);
}
}
}
Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Sun Sep 27 02:38:41 2009
@@ -237,7 +237,7 @@
// 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);
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Sep 27 02:38:41 2009
@@ -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 @@
// 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 @@
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);
Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Sun Sep 27 02:38:41 2009
@@ -306,7 +306,7 @@
// 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;
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Sun Sep 27 02:38:41 2009
@@ -663,7 +663,7 @@
if (I != I->getParent()->begin()) {
BasicBlock::iterator BBI = I; --BBI;
if (DbgStopPointInst *DSPI = dyn_cast<DbgStopPointInst>(BBI)) {
- CallInst *newDSPI = DSPI->clone(I->getContext());
+ CallInst *newDSPI = DSPI->clone();
newDSPI->insertBefore(InsertPos);
}
}
Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Sun Sep 27 02:38:41 2009
@@ -43,7 +43,7 @@
// Loop over all instructions, and copy them over.
for (BasicBlock::const_iterator II = BB->begin(), IE = BB->end();
II != IE; ++II) {
- Instruction *NewInst = II->clone(BB->getContext());
+ Instruction *NewInst = II->clone();
if (II->hasName())
NewInst->setName(II->getName()+NameSuffix);
NewBB->getInstList().push_back(NewInst);
@@ -248,7 +248,7 @@
continue;
}
- Instruction *NewInst = II->clone(BB->getContext());
+ Instruction *NewInst = II->clone();
if (II->hasName())
NewInst->setName(II->getName()+NameSuffix);
NewBB->getInstList().push_back(NewInst);
@@ -296,7 +296,7 @@
}
if (!TerminatorDone) {
- Instruction *NewInst = OldTI->clone(BB->getContext());
+ Instruction *NewInst = OldTI->clone();
if (OldTI->hasName())
NewInst->setName(OldTI->getName()+NameSuffix);
NewBB->getInstList().push_back(NewInst);
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sun Sep 27 02:38:41 2009
@@ -374,7 +374,7 @@
BI != BE; ++BI) {
if (DbgStopPointInst *DSPI = dyn_cast<DbgStopPointInst>(BI)) {
if (DbgRegionEndInst *NewDREI =
- dyn_cast<DbgRegionEndInst>(DREI->clone(Context)))
+ dyn_cast<DbgRegionEndInst>(DREI->clone()))
NewDREI->insertAfter(DSPI);
break;
}
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun Sep 27 02:38:41 2009
@@ -16,7 +16,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/GlobalVariable.h"
@@ -911,7 +910,7 @@
return true;
// Okay, it is safe to hoist the terminator.
- Instruction *NT = I1->clone(BB1->getContext());
+ Instruction *NT = I1->clone();
BIParent->getInstList().insert(BI, NT);
if (NT->getType() != Type::getVoidTy(BB1->getContext())) {
I1->replaceAllUsesWith(NT);
@@ -1151,7 +1150,6 @@
/// ultimate destination.
static bool FoldCondBranchOnPHI(BranchInst *BI) {
BasicBlock *BB = BI->getParent();
- LLVMContext &Context = BB->getContext();
PHINode *PN = dyn_cast<PHINode>(BI->getCondition());
// NOTE: we currently cannot transform this case if the PHI node is used
// outside of the block.
@@ -1205,7 +1203,7 @@
TranslateMap[PN] = PN->getIncomingValueForBlock(PredBB);
} else {
// Clone the instruction.
- Instruction *N = BBI->clone(Context);
+ Instruction *N = BBI->clone();
if (BBI->hasName()) N->setName(BBI->getName()+".c");
// Update operands due to translation.
@@ -1218,7 +1216,7 @@
}
// Check for trivial simplification.
- if (Constant *C = ConstantFoldInstruction(N, Context)) {
+ if (Constant *C = ConstantFoldInstruction(N, BB->getContext())) {
TranslateMap[BBI] = C;
delete N; // Constant folded away, don't need actual inst
} else {
@@ -1554,7 +1552,7 @@
// Clone Cond into the predecessor basic block, and or/and the
// two conditions together.
- Instruction *New = Cond->clone(BB->getContext());
+ Instruction *New = Cond->clone();
PredBlock->getInstList().insert(PBI, New);
New->takeName(Cond);
Cond->setName(New->getName()+".old");
@@ -1814,7 +1812,7 @@
<< "INTO UNCOND BRANCH PRED: " << *Pred);
Instruction *UncondBranch = Pred->getTerminator();
// Clone the return and add it to the end of the predecessor.
- Instruction *NewRet = RI->clone(BB->getContext());
+ Instruction *NewRet = RI->clone();
Pred->getInstList().push_back(NewRet);
BasicBlock::iterator BBI = RI;
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82889&r1=82888&r2=82889&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Sep 27 02:38:41 2009
@@ -2999,7 +2999,7 @@
// Define these methods here so vtables don't get emitted into every translation
// unit that uses these classes.
-GetElementPtrInst *GetElementPtrInst::clone(LLVMContext&) const {
+GetElementPtrInst *GetElementPtrInst::clone() const {
GetElementPtrInst *New = new(getNumOperands()) GetElementPtrInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3009,7 +3009,7 @@
return New;
}
-BinaryOperator *BinaryOperator::clone(LLVMContext&) const {
+BinaryOperator *BinaryOperator::clone() const {
BinaryOperator *New = Create(getOpcode(), Op<0>(), Op<1>());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3019,7 +3019,7 @@
return New;
}
-FCmpInst* FCmpInst::clone(LLVMContext &Context) const {
+FCmpInst* FCmpInst::clone() const {
FCmpInst *New = new FCmpInst(getPredicate(), Op<0>(), Op<1>());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3028,7 +3028,7 @@
}
return New;
}
-ICmpInst* ICmpInst::clone(LLVMContext &Context) const {
+ICmpInst* ICmpInst::clone() const {
ICmpInst *New = new ICmpInst(getPredicate(), Op<0>(), Op<1>());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3038,7 +3038,7 @@
return New;
}
-ExtractValueInst *ExtractValueInst::clone(LLVMContext&) const {
+ExtractValueInst *ExtractValueInst::clone() const {
ExtractValueInst *New = new ExtractValueInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3047,7 +3047,7 @@
}
return New;
}
-InsertValueInst *InsertValueInst::clone(LLVMContext&) const {
+InsertValueInst *InsertValueInst::clone() const {
InsertValueInst *New = new InsertValueInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3057,7 +3057,7 @@
return New;
}
-MallocInst *MallocInst::clone(LLVMContext&) const {
+MallocInst *MallocInst::clone() const {
MallocInst *New = new MallocInst(getAllocatedType(),
(Value*)getOperand(0),
getAlignment());
@@ -3069,7 +3069,7 @@
return New;
}
-AllocaInst *AllocaInst::clone(LLVMContext&) const {
+AllocaInst *AllocaInst::clone() const {
AllocaInst *New = new AllocaInst(getAllocatedType(),
(Value*)getOperand(0),
getAlignment());
@@ -3081,7 +3081,7 @@
return New;
}
-FreeInst *FreeInst::clone(LLVMContext&) const {
+FreeInst *FreeInst::clone() const {
FreeInst *New = new FreeInst(getOperand(0));
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3091,7 +3091,7 @@
return New;
}
-LoadInst *LoadInst::clone(LLVMContext&) const {
+LoadInst *LoadInst::clone() const {
LoadInst *New = new LoadInst(getOperand(0),
Twine(), isVolatile(),
getAlignment());
@@ -3103,7 +3103,7 @@
return New;
}
-StoreInst *StoreInst::clone(LLVMContext&) const {
+StoreInst *StoreInst::clone() const {
StoreInst *New = new StoreInst(getOperand(0), getOperand(1),
isVolatile(), getAlignment());
New->SubclassOptionalData = SubclassOptionalData;
@@ -3114,7 +3114,7 @@
return New;
}
-TruncInst *TruncInst::clone(LLVMContext&) const {
+TruncInst *TruncInst::clone() const {
TruncInst *New = new TruncInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3124,7 +3124,7 @@
return New;
}
-ZExtInst *ZExtInst::clone(LLVMContext&) const {
+ZExtInst *ZExtInst::clone() const {
ZExtInst *New = new ZExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3134,7 +3134,7 @@
return New;
}
-SExtInst *SExtInst::clone(LLVMContext&) const {
+SExtInst *SExtInst::clone() const {
SExtInst *New = new SExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3144,7 +3144,7 @@
return New;
}
-FPTruncInst *FPTruncInst::clone(LLVMContext&) const {
+FPTruncInst *FPTruncInst::clone() const {
FPTruncInst *New = new FPTruncInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3154,7 +3154,7 @@
return New;
}
-FPExtInst *FPExtInst::clone(LLVMContext&) const {
+FPExtInst *FPExtInst::clone() const {
FPExtInst *New = new FPExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3164,7 +3164,7 @@
return New;
}
-UIToFPInst *UIToFPInst::clone(LLVMContext&) const {
+UIToFPInst *UIToFPInst::clone() const {
UIToFPInst *New = new UIToFPInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3174,7 +3174,7 @@
return New;
}
-SIToFPInst *SIToFPInst::clone(LLVMContext&) const {
+SIToFPInst *SIToFPInst::clone() const {
SIToFPInst *New = new SIToFPInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3184,7 +3184,7 @@
return New;
}
-FPToUIInst *FPToUIInst::clone(LLVMContext&) const {
+FPToUIInst *FPToUIInst::clone() const {
FPToUIInst *New = new FPToUIInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3194,7 +3194,7 @@
return New;
}
-FPToSIInst *FPToSIInst::clone(LLVMContext&) const {
+FPToSIInst *FPToSIInst::clone() const {
FPToSIInst *New = new FPToSIInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3204,7 +3204,7 @@
return New;
}
-PtrToIntInst *PtrToIntInst::clone(LLVMContext&) const {
+PtrToIntInst *PtrToIntInst::clone() const {
PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3214,7 +3214,7 @@
return New;
}
-IntToPtrInst *IntToPtrInst::clone(LLVMContext&) const {
+IntToPtrInst *IntToPtrInst::clone() const {
IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3224,7 +3224,7 @@
return New;
}
-BitCastInst *BitCastInst::clone(LLVMContext&) const {
+BitCastInst *BitCastInst::clone() const {
BitCastInst *New = new BitCastInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3234,7 +3234,7 @@
return New;
}
-CallInst *CallInst::clone(LLVMContext&) const {
+CallInst *CallInst::clone() const {
CallInst *New = new(getNumOperands()) CallInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3244,7 +3244,7 @@
return New;
}
-SelectInst *SelectInst::clone(LLVMContext&) const {
+SelectInst *SelectInst::clone() const {
SelectInst *New = SelectInst::Create(getOperand(0),
getOperand(1),
getOperand(2));
@@ -3256,7 +3256,7 @@
return New;
}
-VAArgInst *VAArgInst::clone(LLVMContext&) const {
+VAArgInst *VAArgInst::clone() const {
VAArgInst *New = new VAArgInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3266,7 +3266,7 @@
return New;
}
-ExtractElementInst *ExtractElementInst::clone(LLVMContext&) const {
+ExtractElementInst *ExtractElementInst::clone() const {
ExtractElementInst *New = ExtractElementInst::Create(getOperand(0),
getOperand(1));
New->SubclassOptionalData = SubclassOptionalData;
@@ -3277,7 +3277,7 @@
return New;
}
-InsertElementInst *InsertElementInst::clone(LLVMContext&) const {
+InsertElementInst *InsertElementInst::clone() const {
InsertElementInst *New = InsertElementInst::Create(getOperand(0),
getOperand(1),
getOperand(2));
@@ -3289,7 +3289,7 @@
return New;
}
-ShuffleVectorInst *ShuffleVectorInst::clone(LLVMContext&) const {
+ShuffleVectorInst *ShuffleVectorInst::clone() const {
ShuffleVectorInst *New = new ShuffleVectorInst(getOperand(0),
getOperand(1),
getOperand(2));
@@ -3301,7 +3301,7 @@
return New;
}
-PHINode *PHINode::clone(LLVMContext&) const {
+PHINode *PHINode::clone() const {
PHINode *New = new PHINode(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3311,7 +3311,7 @@
return New;
}
-ReturnInst *ReturnInst::clone(LLVMContext&) const {
+ReturnInst *ReturnInst::clone() const {
ReturnInst *New = new(getNumOperands()) ReturnInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3321,7 +3321,7 @@
return New;
}
-BranchInst *BranchInst::clone(LLVMContext&) const {
+BranchInst *BranchInst::clone() const {
unsigned Ops(getNumOperands());
BranchInst *New = new(Ops, Ops == 1) BranchInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
@@ -3332,7 +3332,7 @@
return New;
}
-SwitchInst *SwitchInst::clone(LLVMContext&) const {
+SwitchInst *SwitchInst::clone() const {
SwitchInst *New = new SwitchInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3342,7 +3342,7 @@
return New;
}
-InvokeInst *InvokeInst::clone(LLVMContext&) const {
+InvokeInst *InvokeInst::clone() const {
InvokeInst *New = new(getNumOperands()) InvokeInst(*this);
New->SubclassOptionalData = SubclassOptionalData;
if (hasMetadata()) {
@@ -3352,22 +3352,20 @@
return New;
}
-UnwindInst *UnwindInst::clone(LLVMContext &C) const {
- UnwindInst *New = new UnwindInst(C);
+UnwindInst *UnwindInst::clone() const {
+ LLVMContext &Context = getContext();
+ UnwindInst *New = new UnwindInst(Context);
New->SubclassOptionalData = SubclassOptionalData;
- if (hasMetadata()) {
- LLVMContext &Context = getContext();
+ if (hasMetadata())
Context.pImpl->TheMetadata.ValueIsCloned(this, New);
- }
return New;
}
-UnreachableInst *UnreachableInst::clone(LLVMContext &C) const {
- UnreachableInst *New = new UnreachableInst(C);
+UnreachableInst *UnreachableInst::clone() const {
+ LLVMContext &Context = getContext();
+ UnreachableInst *New = new UnreachableInst(Context);
New->SubclassOptionalData = SubclassOptionalData;
- if (hasMetadata()) {
- LLVMContext &Context = getContext();
+ if (hasMetadata())
Context.pImpl->TheMetadata.ValueIsCloned(this, New);
- }
return New;
}
More information about the llvm-commits
mailing list