class UnaryInstruction : public Instruction {
void *operator new(size_t, unsigned); // Do not implement
- UnaryInstruction(const UnaryInstruction&); // Do not implement
protected:
UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
/// if (isa<CastInst>(Instr)) { ... }
/// @brief Base class of casting instructions.
class CastInst : public UnaryInstruction {
- /// @brief Copy constructor
- CastInst(const CastInst &CI)
- : UnaryInstruction(CI.getType(), CI.getOpcode(), CI.getOperand(0)) {
- }
- /// @brief Do not allow default construction
- CastInst();
protected:
/// @brief Constructor with insert-before-instruction semantics for subclasses
CastInst(const Type *Ty, unsigned iType, Value *S,
/// extra information (e.g. load is volatile) agree.
bool isIdenticalTo(const Instruction *I) const;
+ /// isIdenticalToWhenDefined - This is like isIdenticalTo, except that it
+ /// ignores the SubclassOptionalData flags, which specify conditions
+ /// under which the instruction's result is undefined.
+ bool isIdenticalToWhenDefined(const Instruction *I) const;
+
/// This function determines if the specified instruction executes the same
/// operation as the current one. This means that the opcodes, type, operand
/// types and any other factors affecting the operation must be the same. This
/// MallocInst - an instruction to allocated memory on the heap
///
class MallocInst : public AllocationInst {
- MallocInst(const MallocInst &MI);
public:
explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
const Twine &NameStr = "",
/// AllocaInst - an instruction to allocate memory on the stack
///
class AllocaInst : public AllocationInst {
- AllocaInst(const AllocaInst &);
public:
explicit AllocaInst(const Type *Ty,
Value *ArraySize = 0,
/// SubclassData field in Value to store whether or not the load is volatile.
///
class LoadInst : public UnaryInstruction {
-
- LoadInst(const LoadInst &LI)
- : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)) {
- setVolatile(LI.isVolatile());
- setAlignment(LI.getAlignment());
-
-#ifndef NDEBUG
- AssertOK();
-#endif
- }
void AssertOK();
public:
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore);
///
class StoreInst : public Instruction {
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
-
- StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store,
- &Op<0>(), 2) {
- Op<0>() = SI.Op<0>();
- Op<1>() = SI.Op<1>();
- setVolatile(SI.isVolatile());
- setAlignment(SI.getAlignment());
-
-#ifndef NDEBUG
- AssertOK();
-#endif
- }
void AssertOK();
public:
// allocate space for exactly two operands
Op<2>() = S2;
}
- SelectInst(const SelectInst &SI)
- : Instruction(SI.getType(), SI.getOpcode(), &Op<0>(), 3) {
- init(SI.Op<0>(), SI.Op<1>(), SI.Op<2>());
- }
SelectInst(Value *C, Value *S1, Value *S2, const Twine &NameStr,
Instruction *InsertBefore)
: Instruction(S1->getType(), Instruction::Select,
/// an argument of the specified type given a va_list and increments that list
///
class VAArgInst : public UnaryInstruction {
- VAArgInst(const VAArgInst &VAA)
- : UnaryInstruction(VAA.getType(), VAArg, VAA.getOperand(0)) {}
public:
VAArgInst(Value *List, const Type *Ty, const Twine &NameStr = "",
Instruction *InsertBefore = 0)
/// element from a VectorType value
///
class ExtractElementInst : public Instruction {
- ExtractElementInst(const ExtractElementInst &EE) :
- Instruction(EE.getType(), ExtractElement, &Op<0>(), 2) {
- Op<0>() = EE.Op<0>();
- Op<1>() = EE.Op<1>();
- }
-
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
Instruction *InsertBefore = 0);
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock *InsertAtEnd);
public:
static ExtractElementInst *Create(const ExtractElementInst &EE) {
- return new(EE.getNumOperands()) ExtractElementInst(EE);
+ return Create(EE.getOperand(0), EE.getOperand(1));
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
/// element into a VectorType value
///
class InsertElementInst : public Instruction {
- InsertElementInst(const InsertElementInst &IE);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0);
const Twine &NameStr, BasicBlock *InsertAtEnd);
public:
static InsertElementInst *Create(const InsertElementInst &IE) {
- return new(IE.getNumOperands()) InsertElementInst(IE);
+ return Create(IE.getOperand(0), IE.getOperand(1), IE.getOperand(2));
}
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
/// input vectors.
///
class ShuffleVectorInst : public Instruction {
- ShuffleVectorInst(const ShuffleVectorInst &IE);
public:
// allocate space for exactly three operands
void *operator new(size_t s) {
/// @brief This class represents a truncation of integer types.
class TruncInst : public CastInst {
- /// Private copy constructor
- TruncInst(const TruncInst &CI)
- : CastInst(CI.getType(), Trunc, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
TruncInst(
/// @brief This class represents zero extension of integer types.
class ZExtInst : public CastInst {
- /// @brief Private copy constructor
- ZExtInst(const ZExtInst &CI)
- : CastInst(CI.getType(), ZExt, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
ZExtInst(
/// @brief This class represents a sign extension of integer types.
class SExtInst : public CastInst {
- /// @brief Private copy constructor
- SExtInst(const SExtInst &CI)
- : CastInst(CI.getType(), SExt, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
SExtInst(
/// @brief This class represents a truncation of floating point types.
class FPTruncInst : public CastInst {
- FPTruncInst(const FPTruncInst &CI)
- : CastInst(CI.getType(), FPTrunc, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
FPTruncInst(
/// @brief This class represents an extension of floating point types.
class FPExtInst : public CastInst {
- FPExtInst(const FPExtInst &CI)
- : CastInst(CI.getType(), FPExt, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
FPExtInst(
/// @brief This class represents a cast unsigned integer to floating point.
class UIToFPInst : public CastInst {
- UIToFPInst(const UIToFPInst &CI)
- : CastInst(CI.getType(), UIToFP, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
UIToFPInst(
/// @brief This class represents a cast from signed integer to floating point.
class SIToFPInst : public CastInst {
- SIToFPInst(const SIToFPInst &CI)
- : CastInst(CI.getType(), SIToFP, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
SIToFPInst(
/// @brief This class represents a cast from floating point to unsigned integer
class FPToUIInst : public CastInst {
- FPToUIInst(const FPToUIInst &CI)
- : CastInst(CI.getType(), FPToUI, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
FPToUIInst(
/// @brief This class represents a cast from floating point to signed integer.
class FPToSIInst : public CastInst {
- FPToSIInst(const FPToSIInst &CI)
- : CastInst(CI.getType(), FPToSI, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
FPToSIInst(
/// @brief This class represents a cast from an integer to a pointer.
class IntToPtrInst : public CastInst {
- IntToPtrInst(const IntToPtrInst &CI)
- : CastInst(CI.getType(), IntToPtr, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
IntToPtrInst(
/// @brief This class represents a cast from a pointer to an integer
class PtrToIntInst : public CastInst {
- PtrToIntInst(const PtrToIntInst &CI)
- : CastInst(CI.getType(), PtrToInt, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
PtrToIntInst(
/// @brief This class represents a no-op cast from one type to another.
class BitCastInst : public CastInst {
- BitCastInst(const BitCastInst &CI)
- : CastInst(CI.getType(), BitCast, CI.getOperand(0)) {
- }
public:
/// @brief Constructor with insert-before-instruction semantics
BitCastInst(
return SubclassID;
}
+ /// hasSameSubclassOptionalData - Test whether the optional flags contained
+ /// in this value are equal to the optional flags in the given value.
+ bool hasSameSubclassOptionalData(const Value *V) const {
+ return SubclassOptionalData == V->SubclassOptionalData;
+ }
+
+ /// intersectOptionalDataWith - Clear any optional flags in this value
+ /// that are not also set in the given value.
+ void intersectOptionalDataWith(const Value *V) {
+ SubclassOptionalData &= V->SubclassOptionalData;
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *) {
return true; // Values are always values.
isEquivalentOperation(const Instruction *I1, const Instruction *I2) {
if (I1->getOpcode() != I2->getOpcode() ||
I1->getNumOperands() != I2->getNumOperands() ||
- !isEquivalentType(I1->getType(), I2->getType()))
+ !isEquivalentType(I1->getType(), I2->getType()) ||
+ !I1->hasSameSubclassOptionalData(I2))
return false;
// We have two instructions of identical opcode and #operands. Check to see
if (A == B) return true;
// Test if the values come form identical arithmetic instructions.
+ // This uses isIdenticalToWhenDefined instead of isIdenticalTo because
+ // its only used to compare two uses within the same basic block, which
+ // means that they'll always either have the same value or one of them
+ // will have an undefined value.
if (isa<BinaryOperator>(A) ||
isa<CastInst>(A) ||
isa<PHINode>(A) ||
isa<GetElementPtrInst>(A))
if (Instruction *BI = dyn_cast<Instruction>(B))
- if (cast<Instruction>(A)->isIdenticalTo(BI))
+ if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
return true;
// Otherwise they may not be equivalent.
// Test if the values are trivially equivalent.
if (A == B) return true;
- // Test if the values come form identical arithmetic instructions.
+ // Test if the values come from identical arithmetic instructions.
+ // Use isIdenticalToWhenDefined instead of isIdenticalTo because
+ // this function is only used when one address use dominates the
+ // other, which means that they'll always either have the same
+ // value or one of them will have an undefined value.
if (isa<BinaryOperator>(A) || isa<CastInst>(A) ||
isa<PHINode>(A) || isa<GetElementPtrInst>(A))
if (const Instruction *BI = dyn_cast<Instruction>(B))
- if (cast<Instruction>(A)->isIdenticalTo(BI))
+ if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
return true;
// Otherwise they may not be equivalent.
while (isa<DbgInfoIntrinsic>(I2))
I2 = BB2_Itr++;
if (I1->getOpcode() != I2->getOpcode() || isa<PHINode>(I1) ||
- !I1->isIdenticalTo(I2) ||
+ !I1->isIdenticalToWhenDefined(I2) ||
(isa<InvokeInst>(I1) && !isSafeToHoistInvoke(BB1, BB2, I1, I2)))
return false;
BIParent->getInstList().splice(BI, BB1->getInstList(), I1);
if (!I2->use_empty())
I2->replaceAllUsesWith(I1);
+ I1->intersectOptionalDataWith(I2);
BB2->getInstList().erase(I2);
I1 = BB1_Itr++;
I2 = BB2_Itr++;
while (isa<DbgInfoIntrinsic>(I2))
I2 = BB2_Itr++;
- } while (I1->getOpcode() == I2->getOpcode() && I1->isIdenticalTo(I2));
+ } while (I1->getOpcode() == I2->getOpcode() &&
+ I1->isIdenticalToWhenDefined(I2));
return true;
/// identical to the current one. This means that all operands match and any
/// extra information (e.g. load is volatile) agree.
bool Instruction::isIdenticalTo(const Instruction *I) const {
+ return isIdenticalTo(I) &&
+ SubclassOptionalData == I->SubclassOptionalData;
+}
+
+/// isIdenticalToWenDefined - This is like isIdenticalTo, except that it
+/// ignores the SubclassOptionalData flags, which specify conditions
+/// under which the instruction's result is undefined.
+bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const {
if (getOpcode() != I->getOpcode() ||
getNumOperands() != I->getNumOperands() ||
getType() != I->getType())
OL[i] = PN.getOperand(i);
OL[i+1] = PN.getOperand(i+1);
}
+ SubclassOptionalData = PN.SubclassOptionalData;
}
PHINode::~PHINode() {
Use *InOL = CI.OperandList;
for (unsigned i = 0, e = CI.getNumOperands(); i != e; ++i)
OL[i] = InOL[i];
+ SubclassOptionalData = CI.SubclassOptionalData;
}
void CallInst::addAttribute(unsigned i, Attributes attr) {
Use *OL = OperandList, *InOL = II.OperandList;
for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i)
OL[i] = InOL[i];
+ SubclassOptionalData = II.SubclassOptionalData;
}
BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const {
RI.getNumOperands()) {
if (RI.getNumOperands())
Op<0>() = RI.Op<0>();
+ SubclassOptionalData = RI.SubclassOptionalData;
}
ReturnInst::ReturnInst(LLVMContext &C, Value *retVal, Instruction *InsertBefore)
Op<-3>() = BI.Op<-3>();
Op<-2>() = BI.Op<-2>();
}
+ SubclassOptionalData = BI.SubclassOptionalData;
}
return getType()->getElementType();
}
-AllocaInst::AllocaInst(const AllocaInst &AI)
- : AllocationInst(AI.getType()->getElementType(),
- (Value*)AI.getOperand(0), Instruction::Alloca,
- AI.getAlignment()) {
-}
-
/// 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
/// into the prolog/epilog code, so it is basically free.
return Parent == &Parent->getParent()->front();
}
-MallocInst::MallocInst(const MallocInst &MI)
- : AllocationInst(MI.getType()->getElementType(),
- (Value*)MI.getOperand(0), Instruction::Malloc,
- MI.getAlignment()) {
-}
-
//===----------------------------------------------------------------------===//
// FreeInst Implementation
//===----------------------------------------------------------------------===//
Use *GEPIOL = GEPI.OperandList;
for (unsigned i = 0, E = NumOperands; i != E; ++i)
OL[i] = GEPIOL[i];
+ SubclassOptionalData = GEPI.SubclassOptionalData;
}
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
// InsertElementInst Implementation
//===----------------------------------------------------------------------===//
-InsertElementInst::InsertElementInst(const InsertElementInst &IE)
- : Instruction(IE.getType(), InsertElement,
- OperandTraits<InsertElementInst>::op_begin(this), 3) {
- Op<0>() = IE.Op<0>();
- Op<1>() = IE.Op<1>();
- Op<2>() = IE.Op<2>();
-}
InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
const Twine &Name,
Instruction *InsertBef)
// ShuffleVectorInst Implementation
//===----------------------------------------------------------------------===//
-ShuffleVectorInst::ShuffleVectorInst(const ShuffleVectorInst &SV)
- : Instruction(SV.getType(), ShuffleVector,
- OperandTraits<ShuffleVectorInst>::op_begin(this),
- OperandTraits<ShuffleVectorInst>::operands(this)) {
- Op<0>() = SV.Op<0>();
- Op<1>() = SV.Op<1>();
- Op<2>() = SV.Op<2>();
-}
-
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &Name,
Instruction *InsertBefore)
Indices(IVI.Indices) {
Op<0>() = IVI.getOperand(0);
Op<1>() = IVI.getOperand(1);
+ SubclassOptionalData = IVI.SubclassOptionalData;
}
InsertValueInst::InsertValueInst(Value *Agg,
ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
: UnaryInstruction(EVI.getType(), ExtractValue, EVI.getOperand(0)),
Indices(EVI.Indices) {
+ SubclassOptionalData = EVI.SubclassOptionalData;
}
// getIndexedType - Returns the type of the element that would be extracted
OL[i] = InOL[i];
OL[i+1] = InOL[i+1];
}
+ SubclassOptionalData = SI.SubclassOptionalData;
}
SwitchInst::~SwitchInst() {
// unit that uses these classes.
GetElementPtrInst *GetElementPtrInst::clone(LLVMContext&) const {
- return new(getNumOperands()) GetElementPtrInst(*this);
+ GetElementPtrInst *New = new(getNumOperands()) GetElementPtrInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
BinaryOperator *BinaryOperator::clone(LLVMContext&) const {
- return Create(getOpcode(), Op<0>(), Op<1>());
+ BinaryOperator *New = Create(getOpcode(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
FCmpInst* FCmpInst::clone(LLVMContext &Context) const {
- return new FCmpInst(Context, getPredicate(), Op<0>(), Op<1>());
+ FCmpInst *New = new FCmpInst(Context, getPredicate(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
ICmpInst* ICmpInst::clone(LLVMContext &Context) const {
- return new ICmpInst(Context, getPredicate(), Op<0>(), Op<1>());
+ ICmpInst *New = new ICmpInst(Context, getPredicate(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
ExtractValueInst *ExtractValueInst::clone(LLVMContext&) const {
- return new ExtractValueInst(*this);
+ ExtractValueInst *New = new ExtractValueInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
InsertValueInst *InsertValueInst::clone(LLVMContext&) const {
- return new InsertValueInst(*this);
+ InsertValueInst *New = new InsertValueInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
MallocInst *MallocInst::clone(LLVMContext&) const {
- return new MallocInst(*this);
+ MallocInst *New = new MallocInst(getAllocatedType(),
+ (Value*)getOperand(0),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
AllocaInst *AllocaInst::clone(LLVMContext&) const {
- return new AllocaInst(*this);
+ AllocaInst *New = new AllocaInst(getAllocatedType(),
+ (Value*)getOperand(0),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
FreeInst *FreeInst::clone(LLVMContext&) const {
- return new FreeInst(getOperand(0));
+ FreeInst *New = new FreeInst(getOperand(0));
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
LoadInst *LoadInst::clone(LLVMContext&) const {
- return new LoadInst(*this);
+ LoadInst *New = new LoadInst(getOperand(0),
+ Twine(), isVolatile(),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
StoreInst *StoreInst::clone(LLVMContext&) const {
- return new StoreInst(*this);
+ StoreInst *New = new StoreInst(getOperand(0), getOperand(1),
+ isVolatile(), getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *TruncInst::clone(LLVMContext&) const {
- return new TruncInst(*this);
+ TruncInst *New = new TruncInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *ZExtInst::clone(LLVMContext&) const {
- return new ZExtInst(*this);
+ ZExtInst *New = new ZExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *SExtInst::clone(LLVMContext&) const {
- return new SExtInst(*this);
+ SExtInst *New = new SExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *FPTruncInst::clone(LLVMContext&) const {
- return new FPTruncInst(*this);
+ FPTruncInst *New = new FPTruncInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *FPExtInst::clone(LLVMContext&) const {
- return new FPExtInst(*this);
+ FPExtInst *New = new FPExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *UIToFPInst::clone(LLVMContext&) const {
- return new UIToFPInst(*this);
+ UIToFPInst *New = new UIToFPInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *SIToFPInst::clone(LLVMContext&) const {
- return new SIToFPInst(*this);
+ SIToFPInst *New = new SIToFPInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *FPToUIInst::clone(LLVMContext&) const {
- return new FPToUIInst(*this);
+ FPToUIInst *New = new FPToUIInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *FPToSIInst::clone(LLVMContext&) const {
- return new FPToSIInst(*this);
+ FPToSIInst *New = new FPToSIInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *PtrToIntInst::clone(LLVMContext&) const {
- return new PtrToIntInst(*this);
+ PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *IntToPtrInst::clone(LLVMContext&) const {
- return new IntToPtrInst(*this);
+ IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CastInst *BitCastInst::clone(LLVMContext&) const {
- return new BitCastInst(*this);
+ BitCastInst *New = new BitCastInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
CallInst *CallInst::clone(LLVMContext&) const {
- return new(getNumOperands()) CallInst(*this);
+ CallInst *New = new(getNumOperands()) CallInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
-SelectInst *SelectInst::clone(LLVMContext&) const {
- return new(getNumOperands()) SelectInst(*this);
+SelectInst *SelectInst::clone(LLVMContext&) const {
+ SelectInst *New = SelectInst::Create(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
VAArgInst *VAArgInst::clone(LLVMContext&) const {
- return new VAArgInst(*this);
+ VAArgInst *New = new VAArgInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
ExtractElementInst *ExtractElementInst::clone(LLVMContext&) const {
- return ExtractElementInst::Create(*this);
+ ExtractElementInst *New = ExtractElementInst::Create(getOperand(0),
+ getOperand(1));
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
InsertElementInst *InsertElementInst::clone(LLVMContext&) const {
- return InsertElementInst::Create(*this);
+ InsertElementInst *New = InsertElementInst::Create(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
ShuffleVectorInst *ShuffleVectorInst::clone(LLVMContext&) const {
- return new ShuffleVectorInst(*this);
+ ShuffleVectorInst *New = new ShuffleVectorInst(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
PHINode *PHINode::clone(LLVMContext&) const {
- return new PHINode(*this);
+ PHINode *New = new PHINode(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
ReturnInst *ReturnInst::clone(LLVMContext&) const {
- return new(getNumOperands()) ReturnInst(*this);
+ ReturnInst *New = new(getNumOperands()) ReturnInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
BranchInst *BranchInst::clone(LLVMContext&) const {
unsigned Ops(getNumOperands());
- return new(Ops, Ops == 1) BranchInst(*this);
+ BranchInst *New = new(Ops, Ops == 1) BranchInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
SwitchInst *SwitchInst::clone(LLVMContext&) const {
- return new SwitchInst(*this);
+ SwitchInst *New = new SwitchInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
InvokeInst *InvokeInst::clone(LLVMContext&) const {
- return new(getNumOperands()) InvokeInst(*this);
+ InvokeInst *New = new(getNumOperands()) InvokeInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
UnwindInst *UnwindInst::clone(LLVMContext &C) const {
- return new UnwindInst(C);
+ UnwindInst *New = new UnwindInst(C);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}
UnreachableInst *UnreachableInst::clone(LLVMContext &C) const {
- return new UnreachableInst(C);
+ UnreachableInst *New = new UnreachableInst(C);
+ New->SubclassOptionalData = SubclassOptionalData;
+ return New;
}