[llvm] [RemoveDIs][NFC] Remove Instruction constructors that insert prior to Instructions (PR #85980)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 20 11:02:37 PDT 2024
https://github.com/SLTozer created https://github.com/llvm/llvm-project/pull/85980
This patch was written almost entirely by @jmorse, but he's on holiday for a while so I'll be handling it. For background reference, see this discourse post:
As a step to ensure the correctness of the RemoveDIs project, we're looking to remove all the constructors/static-creation methods for Instructions that take an `Instruction*` to insert before. The benefit from this is that it prevents us from accidentally clearing the head-insertion bit in instruction iterators, which is important for preventing incorrect debug info placement, which can result in errors (example [here](https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939/20).
Removing these constructors will be a pain for downstream developers, since it will result in a lot of build errors wherever the Instruction-taking constructors are used; the good news is that it should generally be simple to fix these, instructions for which are in the above discourse post. Although this is a fairly disruptive change up-front, once it's landed and uses of the old constructors have been updated, it should continue to ensure that debug info is handled correctly without very much/any thought required going onwards.
>From f2b457ea13f2e1eb0ebac81f000bb67c19f40d63 Mon Sep 17 00:00:00 2001
From: Jeremy Morse <jeremy.morse at sony.com>
Date: Thu, 29 Feb 2024 14:03:13 +0000
Subject: [PATCH] The taking-away-things changes
---
llvm/include/llvm/IR/InstrTypes.h | 346 +++--------
llvm/include/llvm/IR/Instruction.h | 4 +-
llvm/include/llvm/IR/Instructions.h | 898 +++++-----------------------
llvm/lib/IR/Instruction.cpp | 12 -
llvm/lib/IR/Instructions.cpp | 632 ++------------------
5 files changed, 284 insertions(+), 1608 deletions(-)
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index fed21b992e3d10..74476dd773b822 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -59,12 +59,8 @@ class UnaryInstruction : public Instruction {
Op<0>() = V;
}
UnaryInstruction(Type *Ty, unsigned iType, Value *V,
- Instruction *IB = nullptr)
- : Instruction(Ty, iType, &Op<0>(), 1, IB) {
- Op<0>() = V;
- }
- UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
- : Instruction(Ty, iType, &Op<0>(), 1, IAE) {
+ BasicBlock *IAE = nullptr)
+ : Instruction(Ty, iType, &Op<0>(), 1, IAE) {
Op<0>() = V;
}
@@ -107,8 +103,6 @@ class UnaryOperator : public UnaryInstruction {
protected:
UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
const Twine &Name, BasicBlock::iterator InsertBefore);
- UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
- const Twine &Name, Instruction *InsertBefore);
UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
const Twine &Name, BasicBlock *InsertAtEnd);
@@ -125,22 +119,13 @@ class UnaryOperator : public UnaryInstruction {
static UnaryOperator *Create(UnaryOps Op, Value *S, const Twine &Name,
BasicBlock::iterator InsertBefore);
- /// Construct a unary instruction, given the opcode and an operand.
- /// Optionally (if InstBefore is specified) insert the instruction
- /// into a BasicBlock right before the specified instruction. The specified
- /// Instruction is allowed to be a dereferenced end iterator.
- ///
- static UnaryOperator *Create(UnaryOps Op, Value *S,
- const Twine &Name = Twine(),
- Instruction *InsertBefore = nullptr);
-
/// Construct a unary instruction, given the opcode and an operand.
/// Also automatically insert this instruction to the end of the
/// BasicBlock specified.
///
static UnaryOperator *Create(UnaryOps Op, Value *S,
- const Twine &Name,
- BasicBlock *InsertAtEnd);
+ const Twine &Name = Twine(),
+ BasicBlock *InsertAtEnd = nullptr);
/// These methods just forward to Create, and are useful when you
/// statically know what type of instruction you're going to create. These
@@ -156,12 +141,6 @@ class UnaryOperator : public UnaryInstruction {
return Create(Instruction::OPC, V, Name, BB);\
}
#include "llvm/IR/Instruction.def"
-#define HANDLE_UNARY_INST(N, OPC, CLASS) \
- static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
- Instruction *I) {\
- return Create(Instruction::OPC, V, Name, I);\
- }
-#include "llvm/IR/Instruction.def"
#define HANDLE_UNARY_INST(N, OPC, CLASS) \
static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
BasicBlock::iterator It) {\
@@ -177,11 +156,10 @@ class UnaryOperator : public UnaryInstruction {
return UO;
}
- static UnaryOperator *
- CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
- UnaryOperator *UO = Create(Opc, V, Name, InsertBefore);
+ static UnaryOperator *CreateWithCopiedFlags(UnaryOps Opc, Value *V,
+ Instruction *CopyO,
+ const Twine &Name = "") {
+ UnaryOperator *UO = Create(Opc, V, Name);
UO->copyIRFlags(CopyO);
return UO;
}
@@ -194,10 +172,8 @@ class UnaryOperator : public UnaryInstruction {
}
static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
- return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name,
- InsertBefore);
+ const Twine &Name = "") {
+ return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name);
}
UnaryOps getOpcode() const {
@@ -223,8 +199,6 @@ class BinaryOperator : public Instruction {
protected:
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
const Twine &Name, BasicBlock::iterator InsertBefore);
- BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
- const Twine &Name, Instruction *InsertBefore);
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
const Twine &Name, BasicBlock *InsertAtEnd);
@@ -249,21 +223,13 @@ class BinaryOperator : public Instruction {
const Twine &Name,
BasicBlock::iterator InsertBefore);
- /// Construct a binary instruction, given the opcode and the two
- /// operands. Optionally (if InstBefore is specified) insert the instruction
- /// into a BasicBlock right before the specified instruction. The specified
- /// Instruction is allowed to be a dereferenced end iterator.
- ///
- static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
- const Twine &Name = Twine(),
- Instruction *InsertBefore = nullptr);
-
/// Construct a binary instruction, given the opcode and the two
/// operands. Also automatically insert this instruction to the end of the
/// BasicBlock specified.
///
static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
- const Twine &Name, BasicBlock *InsertAtEnd);
+ const Twine &Name = Twine(),
+ BasicBlock *InsertAtEnd = nullptr);
/// These methods just forward to Create, and are useful when you
/// statically know what type of instruction you're going to create. These
@@ -280,12 +246,6 @@ class BinaryOperator : public Instruction {
return Create(Instruction::OPC, V1, V2, Name, BB);\
}
#include "llvm/IR/Instruction.def"
-#define HANDLE_BINARY_INST(N, OPC, CLASS) \
- static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
- const Twine &Name, Instruction *I) {\
- return Create(Instruction::OPC, V1, V2, Name, I);\
- }
-#include "llvm/IR/Instruction.def"
#define HANDLE_BINARY_INST(N, OPC, CLASS) \
static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
const Twine &Name, BasicBlock::iterator It) {\
@@ -301,11 +261,10 @@ class BinaryOperator : public Instruction {
return BO;
}
- static BinaryOperator *
- CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Value *CopyO,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
- BinaryOperator *BO = Create(Opc, V1, V2, Name, InsertBefore);
+ static BinaryOperator *CreateWithCopiedFlags(BinaryOps Opc, Value *V1,
+ Value *V2, Value *CopyO,
+ const Twine &Name = "") {
+ BinaryOperator *BO = Create(Opc, V1, V2, Name, nullptr);
BO->copyIRFlags(CopyO);
return BO;
}
@@ -348,12 +307,6 @@ class BinaryOperator : public Instruction {
BO->setHasNoSignedWrap(true);
return BO;
}
- static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
- const Twine &Name, Instruction *I) {
- BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
- BO->setHasNoSignedWrap(true);
- return BO;
- }
static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
const Twine &Name, BasicBlock::iterator It) {
BinaryOperator *BO = Create(Opc, V1, V2, Name, It);
@@ -373,12 +326,6 @@ class BinaryOperator : public Instruction {
BO->setHasNoUnsignedWrap(true);
return BO;
}
- static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
- const Twine &Name, Instruction *I) {
- BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
- BO->setHasNoUnsignedWrap(true);
- return BO;
- }
static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
const Twine &Name, BasicBlock::iterator It) {
BinaryOperator *BO = Create(Opc, V1, V2, Name, It);
@@ -398,12 +345,6 @@ class BinaryOperator : public Instruction {
BO->setIsExact(true);
return BO;
}
- static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
- const Twine &Name, Instruction *I) {
- BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
- BO->setIsExact(true);
- return BO;
- }
static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
const Twine &Name,
BasicBlock::iterator It) {
@@ -417,9 +358,6 @@ class BinaryOperator : public Instruction {
static inline BinaryOperator *CreateDisjoint(BinaryOps Opc, Value *V1,
Value *V2, const Twine &Name,
BasicBlock *BB);
- static inline BinaryOperator *CreateDisjoint(BinaryOps Opc, Value *V1,
- Value *V2, const Twine &Name,
- Instruction *I);
static inline BinaryOperator *CreateDisjoint(BinaryOps Opc, Value *V1,
Value *V2, const Twine &Name,
BasicBlock::iterator It);
@@ -433,10 +371,6 @@ class BinaryOperator : public Instruction {
Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { \
return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB); \
} \
- static BinaryOperator *Create##NUWNSWEXACT##OPC( \
- Value *V1, Value *V2, const Twine &Name, Instruction *I) { \
- return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I); \
- } \
static BinaryOperator *Create##NUWNSWEXACT##OPC( \
Value *V1, Value *V2, const Twine &Name, BasicBlock::iterator It) { \
return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, It); \
@@ -472,21 +406,15 @@ class BinaryOperator : public Instruction {
static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name,
BasicBlock::iterator InsertBefore);
static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
- Instruction *InsertBefore = nullptr);
- static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
BasicBlock::iterator InsertBefore);
static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name = "",
- Instruction *InsertBefore = nullptr);
- static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
BasicBlock::iterator InsertBefore);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
- Instruction *InsertBefore = nullptr);
- static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
BinaryOps getOpcode() const {
return static_cast<BinaryOps>(Instruction::getOpcode());
@@ -551,13 +479,6 @@ BinaryOperator *BinaryOperator::CreateDisjoint(BinaryOps Opc, Value *V1,
cast<PossiblyDisjointInst>(BO)->setIsDisjoint(true);
return BO;
}
-BinaryOperator *BinaryOperator::CreateDisjoint(BinaryOps Opc, Value *V1,
- Value *V2, const Twine &Name,
- Instruction *I) {
- BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
- cast<PossiblyDisjointInst>(BO)->setIsDisjoint(true);
- return BO;
-}
BinaryOperator *BinaryOperator::CreateDisjoint(BinaryOps Opc, Value *V1,
Value *V2, const Twine &Name,
BasicBlock::iterator It) {
@@ -584,16 +505,10 @@ class CastInst : public UnaryInstruction {
: UnaryInstruction(Ty, iType, S, InsertBefore) {
setName(NameStr);
}
- /// Constructor with insert-before-instruction semantics for subclasses
- CastInst(Type *Ty, unsigned iType, Value *S,
- const Twine &NameStr = "", Instruction *InsertBefore = nullptr)
- : UnaryInstruction(Ty, iType, S, InsertBefore) {
- setName(NameStr);
- }
/// Constructor with insert-at-end-of-block semantics for subclasses
- CastInst(Type *Ty, unsigned iType, Value *S,
- const Twine &NameStr, BasicBlock *InsertAtEnd)
- : UnaryInstruction(Ty, iType, S, InsertAtEnd) {
+ CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr)
+ : UnaryInstruction(Ty, iType, S, InsertAtEnd) {
setName(NameStr);
}
@@ -613,29 +528,17 @@ class CastInst : public UnaryInstruction {
);
/// Provides a way to construct any of the CastInst subclasses using an
/// opcode instead of the subclass's constructor. The opcode must be in the
- /// CastOps category (Instruction::isCast(opcode) returns true). This
- /// constructor has insert-before-instruction semantics to automatically
- /// insert the new CastInst before InsertBefore (if it is non-null).
- /// Construct any of the CastInst subclasses
- static CastInst *Create(
- Instruction::CastOps, ///< The opcode of the cast instruction
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
- /// Provides a way to construct any of the CastInst subclasses using an
- /// opcode instead of the subclass's constructor. The opcode must be in the
/// CastOps category. This constructor has insert-at-end-of-block semantics
/// to automatically insert the new CastInst at the end of InsertAtEnd (if
/// its non-null).
/// Construct any of the CastInst subclasses
- static CastInst *Create(
- Instruction::CastOps, ///< The opcode for the cast instruction
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ Create(Instruction::CastOps, ///< The opcode for the cast instruction
+ Value *S, ///< The value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create a ZExt or BitCast cast instruction
@@ -647,19 +550,12 @@ class CastInst : public UnaryInstruction {
);
/// Create a ZExt or BitCast cast instruction
- static CastInst *CreateZExtOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
- /// Create a ZExt or BitCast cast instruction
- static CastInst *CreateZExtOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreateZExtOrBitCast(Value *S, ///< The value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create a SExt or BitCast cast instruction
@@ -671,27 +567,21 @@ class CastInst : public UnaryInstruction {
);
/// Create a SExt or BitCast cast instruction
- static CastInst *CreateSExtOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
- /// Create a SExt or BitCast cast instruction
- static CastInst *CreateSExtOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreateSExtOrBitCast(Value *S, ///< The value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create a BitCast AddrSpaceCast, or a PtrToInt cast instruction.
- static CastInst *CreatePointerCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreatePointerCast(Value *S, ///< The pointer value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< block to insert the instruction into
);
/// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
@@ -702,20 +592,13 @@ class CastInst : public UnaryInstruction {
BasicBlock::iterator InsertBefore ///< Place to insert the instruction
);
- /// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
- static CastInst *CreatePointerCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
/// Create a BitCast or an AddrSpaceCast cast instruction.
static CastInst *CreatePointerBitCastOrAddrSpaceCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ Value *S, ///< The pointer value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create a BitCast or an AddrSpaceCast cast instruction.
@@ -726,14 +609,6 @@ class CastInst : public UnaryInstruction {
BasicBlock::iterator InsertBefore ///< Place to insert the instruction
);
- /// Create a BitCast or an AddrSpaceCast cast instruction.
- static CastInst *CreatePointerBitCastOrAddrSpaceCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
/// Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
///
/// If the value is a pointer type and the destination an integer type,
@@ -754,10 +629,9 @@ class CastInst : public UnaryInstruction {
/// destination a pointer type, creates an IntToPtr cast. Otherwise, creates
/// a bitcast.
static CastInst *CreateBitOrPointerCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
+ Value *S, ///< The pointer value to be casted (operand 0)
+ Type *Ty, ///< The type to which cast should be made
+ const Twine &Name = "" ///< Name for the instruction
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
@@ -770,21 +644,13 @@ class CastInst : public UnaryInstruction {
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
- static CastInst *CreateIntegerCast(
- Value *S, ///< The pointer value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- bool isSigned, ///< Whether to regard S as signed or not
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
- /// Create a ZExt, BitCast, or Trunc for int -> int casts.
- static CastInst *CreateIntegerCast(
- Value *S, ///< The integer value to be casted (operand 0)
- Type *Ty, ///< The integer type to which operand is casted
- bool isSigned, ///< Whether to regard S as signed or not
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreateIntegerCast(Value *S, ///< The integer value to be casted (operand 0)
+ Type *Ty, ///< The integer type to which operand is casted
+ bool isSigned, ///< Whether to regard S as signed or not
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
@@ -796,19 +662,12 @@ class CastInst : public UnaryInstruction {
);
/// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
- static CastInst *CreateFPCast(
- Value *S, ///< The floating point value to be casted
- Type *Ty, ///< The floating point type to cast to
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
- /// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
- static CastInst *CreateFPCast(
- Value *S, ///< The floating point value to be casted
- Type *Ty, ///< The floating point type to cast to
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreateFPCast(Value *S, ///< The floating point value to be casted
+ Type *Ty, ///< The floating point type to cast to
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Create a Trunc or BitCast cast instruction
@@ -820,19 +679,12 @@ class CastInst : public UnaryInstruction {
);
/// Create a Trunc or BitCast cast instruction
- static CastInst *CreateTruncOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which cast should be made
- const Twine &Name = "", ///< Name for the instruction
- Instruction *InsertBefore = nullptr ///< Place to insert the instruction
- );
-
- /// Create a Trunc or BitCast cast instruction
- static CastInst *CreateTruncOrBitCast(
- Value *S, ///< The value to be casted (operand 0)
- Type *Ty, ///< The type to which operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ static CastInst *
+ CreateTruncOrBitCast(Value *S, ///< The value to be casted (operand 0)
+ Type *Ty, ///< The type to which operand is casted
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Check whether a bitcast between these types is valid
@@ -1019,15 +871,10 @@ class CmpInst : public Instruction {
Value *RHS, const Twine &Name, BasicBlock::iterator InsertBefore,
Instruction *FlagsSource = nullptr);
- CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
- Value *LHS, Value *RHS, const Twine &Name = "",
- Instruction *InsertBefore = nullptr,
+ CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
+ Value *RHS, const Twine &Name = "", BasicBlock *InsertAtEnd = nullptr,
Instruction *FlagsSource = nullptr);
- CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
- Value *LHS, Value *RHS, const Twine &Name,
- BasicBlock *InsertAtEnd);
-
public:
// allocate space for exactly two operands
void *operator new(size_t S) { return User::operator new(S, 2); }
@@ -1040,22 +887,13 @@ class CmpInst : public Instruction {
static CmpInst *Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
const Twine &Name, BasicBlock::iterator InsertBefore);
- /// Construct a compare instruction, given the opcode, the predicate and
- /// the two operands. Optionally (if InstBefore is specified) insert the
- /// instruction into a BasicBlock right before the specified instruction.
- /// The specified Instruction is allowed to be a dereferenced end iterator.
- /// Create a CmpInst
- static CmpInst *Create(OtherOps Op,
- Predicate predicate, Value *S1,
- Value *S2, const Twine &Name = "",
- Instruction *InsertBefore = nullptr);
-
/// Construct a compare instruction, given the opcode, the predicate and the
/// two operands. Also automatically insert this instruction to the end of
/// the BasicBlock specified.
/// Create a CmpInst
- static CmpInst *Create(OtherOps Op, Predicate predicate, Value *S1,
- Value *S2, const Twine &Name, BasicBlock *InsertAtEnd);
+ static CmpInst *Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
+ const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr);
/// Get the opcode casted to the right type
OtherOps getOpcode() const {
@@ -1505,14 +1343,12 @@ class CallBase : public Instruction {
static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
- /// Create a clone of \p CB with a different set of operand bundles and
- /// insert it before \p InsertPt.
+ /// Create a clone of \p CB with a different set of operand bundles.
///
/// The returned call instruction is identical \p CB in every way except that
/// the operand bundles for the new instruction are set to the operand bundles
/// in \p Bundles.
- static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles);
/// Create a clone of \p CB with the operand bundle with the tag matching
/// \p Bundle's tag replaced with Bundle, and insert it before \p InsertPt.
@@ -1523,18 +1359,20 @@ class CallBase : public Instruction {
BasicBlock::iterator InsertPt);
/// Create a clone of \p CB with the operand bundle with the tag matching
- /// \p Bundle's tag replaced with Bundle, and insert it before \p InsertPt.
+ /// \p Bundle's tag replaced with Bundle.
///
/// The returned call instruction is identical \p CI in every way except that
/// the specified operand bundle has been replaced.
- static CallBase *Create(CallBase *CB,
- OperandBundleDef Bundle,
- Instruction *InsertPt = nullptr);
+ static CallBase *Create(CallBase *CB, OperandBundleDef Bundle);
/// Create a clone of \p CB with operand bundle \p OB added.
static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
OperandBundleDef OB,
- Instruction *InsertPt = nullptr);
+ BasicBlock::iterator InsertPt);
+
+ /// Create a clone of \p CB with operand bundle \p OB added.
+ static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
+ OperandBundleDef OB);
/// Create a clone of \p CB with operand bundle \p OB added.
static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
@@ -1543,7 +1381,10 @@ class CallBase : public Instruction {
/// Create a clone of \p CB with operand bundle \p ID removed.
static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
- Instruction *InsertPt = nullptr);
+ BasicBlock::iterator InsertPt);
+
+ /// Create a clone of \p CB with operand bundle \p ID removed.
+ static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID);
/// Create a clone of \p CB with operand bundle \p ID removed.
static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
@@ -2629,9 +2470,6 @@ class FuncletPadInst : public Instruction {
ArrayRef<Value *> Args, unsigned Values,
const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
- ArrayRef<Value *> Args, unsigned Values,
- const Twine &NameStr, Instruction *InsertBefore);
explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
ArrayRef<Value *> Args, unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index d6cf1557752386..2ee4abe8a6154f 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -1011,9 +1011,7 @@ class Instruction : public User,
Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
InstListType::iterator InsertBefore);
Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
- Instruction *InsertBefore = nullptr);
- Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
private:
/// Create a copy of this instruction.
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 4e4cf71a349d74..e8dffbfd1a94e4 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -75,24 +75,18 @@ class AllocaInst : public UnaryInstruction {
public:
explicit AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
const Twine &Name, BasicBlock::iterator InsertBefore);
- explicit AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
- const Twine &Name, Instruction *InsertBefore);
AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
const Twine &Name, BasicBlock *InsertAtEnd);
AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
BasicBlock::iterator InsertBefore);
- AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
- Instruction *InsertBefore);
AllocaInst(Type *Ty, unsigned AddrSpace,
const Twine &Name, BasicBlock *InsertAtEnd);
AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
const Twine &Name, BasicBlock::iterator);
AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
- const Twine &Name = "", Instruction *InsertBefore = nullptr);
- AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
- const Twine &Name, BasicBlock *InsertAtEnd);
+ const Twine &Name = "", BasicBlock *InsertAtEnd = nullptr);
/// Return true if there is an allocation size parameter to the allocation
/// instruction that is not 1.
@@ -200,31 +194,22 @@ class LoadInst : public UnaryInstruction {
public:
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr,
- Instruction *InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
BasicBlock::iterator InsertBefore);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Instruction *InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
BasicBlock *InsertAtEnd);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
Align Align, BasicBlock::iterator InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, Instruction *InsertBefore = nullptr);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, BasicBlock *InsertAtEnd);
+ Align Align, BasicBlock *InsertAtEnd = nullptr);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
Align Align, AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock::iterator InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
Align Align, AtomicOrdering Order,
SyncScope::ID SSID = SyncScope::System,
- Instruction *InsertBefore = nullptr);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, AtomicOrdering Order, SyncScope::ID SSID,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
/// Return true if this is a load from a volatile memory location.
bool isVolatile() const { return getSubclassData<VolatileField>(); }
@@ -331,24 +316,18 @@ class StoreInst : public Instruction {
StoreInst *cloneImpl() const;
public:
- StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
StoreInst(Value *Val, Value *Ptr, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, BasicBlock::iterator InsertBefore);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile, Instruction *InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
BasicBlock::iterator InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- Instruction *InsertBefore = nullptr);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
BasicBlock::iterator InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
- Instruction *InsertBefore = nullptr);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock::iterator InsertBefore);
@@ -475,9 +454,7 @@ class FenceInst : public Instruction {
BasicBlock::iterator InsertBefore);
FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SyncScope::ID SSID = SyncScope::System,
- Instruction *InsertBefore = nullptr);
- FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, 0); }
@@ -560,11 +537,7 @@ class AtomicCmpXchgInst : public Instruction {
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering, SyncScope::ID SSID,
- Instruction *InsertBefore = nullptr);
- AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
- AtomicOrdering SuccessOrdering,
- AtomicOrdering FailureOrdering, SyncScope::ID SSID,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly three operands
void *operator new(size_t S) { return User::operator new(S, 3); }
@@ -824,10 +797,7 @@ class AtomicRMWInst : public Instruction {
BasicBlock::iterator InsertBefore);
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
AtomicOrdering Ordering, SyncScope::ID SSID,
- Instruction *InsertBefore = nullptr);
- AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
- AtomicOrdering Ordering, SyncScope::ID SSID,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly two operands
void *operator new(size_t S) { return User::operator new(S, 2); }
@@ -984,9 +954,6 @@ class GetElementPtrInst : public Instruction {
ArrayRef<Value *> IdxList, unsigned Values,
const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- inline GetElementPtrInst(Type *PointeeType, Value *Ptr,
- ArrayRef<Value *> IdxList, unsigned Values,
- const Twine &NameStr, Instruction *InsertBefore);
inline GetElementPtrInst(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList, unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@@ -1013,17 +980,7 @@ class GetElementPtrInst : public Instruction {
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- unsigned Values = 1 + unsigned(IdxList.size());
- assert(PointeeType && "Must specify element type");
- return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
- NameStr, InsertBefore);
- }
-
- static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
- ArrayRef<Value *> IdxList,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + unsigned(IdxList.size());
assert(PointeeType && "Must specify element type");
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
@@ -1042,20 +999,10 @@ class GetElementPtrInst : public Instruction {
return GEP;
}
- static GetElementPtrInst *
- CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef<Value *> IdxList,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- GetElementPtrInst *GEP =
- Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
- GEP->setIsInBounds(true);
- return GEP;
- }
-
static GetElementPtrInst *CreateInBounds(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
GetElementPtrInst *GEP =
Create(PointeeType, Ptr, IdxList, NameStr, InsertAtEnd);
GEP->setIsInBounds(true);
@@ -1212,18 +1159,6 @@ GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
init(Ptr, IdxList, NameStr);
}
-GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
- ArrayRef<Value *> IdxList, unsigned Values,
- const Twine &NameStr,
- Instruction *InsertBefore)
- : Instruction(getGEPReturnType(Ptr, IdxList), GetElementPtr,
- OperandTraits<GetElementPtrInst>::op_end(this) - Values,
- Values, InsertBefore),
- SourceElementType(PointeeType),
- ResultElementType(getIndexedType(PointeeType, IdxList)) {
- init(Ptr, IdxList, NameStr);
-}
-
GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList, unsigned Values,
const Twine &NameStr,
@@ -1281,21 +1216,6 @@ class ICmpInst: public CmpInst {
#endif
}
- /// Constructor with insert-before-instruction semantics.
- ICmpInst(
- Instruction *InsertBefore, ///< Where to insert
- Predicate pred, ///< The predicate to use for the comparison
- Value *LHS, ///< The left-hand-side of the expression
- Value *RHS, ///< The right-hand-side of the expression
- const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(makeCmpResultType(LHS->getType()),
- Instruction::ICmp, pred, LHS, RHS, NameStr,
- InsertBefore) {
-#ifndef NDEBUG
- AssertOK();
-#endif
- }
-
/// Constructor with insert-at-end semantics.
ICmpInst(
BasicBlock *InsertAtEnd, ///< Block to insert into.
@@ -1466,19 +1386,6 @@ class FCmpInst: public CmpInst {
AssertOK();
}
- /// Constructor with insert-before-instruction semantics.
- FCmpInst(
- Instruction *InsertBefore, ///< Where to insert
- Predicate pred, ///< The predicate to use for the comparison
- Value *LHS, ///< The left-hand-side of the expression
- Value *RHS, ///< The right-hand-side of the expression
- const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(makeCmpResultType(LHS->getType()),
- Instruction::FCmp, pred, LHS, RHS, NameStr,
- InsertBefore) {
- AssertOK();
- }
-
/// Constructor with insert-at-end semantics.
FCmpInst(
BasicBlock *InsertAtEnd, ///< Block to insert into.
@@ -1574,16 +1481,6 @@ class CallInst : public CallBase {
const Twine &NameStr, BasicBlock::iterator InsertBefore)
: CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore) {}
- /// Construct a CallInst given a range of arguments.
- /// Construct a CallInst from a range of arguments
- inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
- Instruction *InsertBefore);
-
- inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr, Instruction *InsertBefore)
- : CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore) {}
-
/// Construct a CallInst given a range of arguments.
/// Construct a CallInst from a range of arguments
inline CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
@@ -1593,9 +1490,6 @@ class CallInst : public CallBase {
explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
- Instruction *InsertBefore);
-
CallInst(FunctionType *ty, Value *F, const Twine &NameStr,
BasicBlock *InsertAtEnd);
@@ -1622,11 +1516,6 @@ class CallInst : public CallBase {
return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertBefore);
}
- static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertBefore);
- }
-
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
const Twine &NameStr,
BasicBlock::iterator InsertBefore) {
@@ -1634,13 +1523,6 @@ class CallInst : public CallBase {
CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore);
}
- static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- return new (ComputeNumOperands(Args.size()))
- CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore);
- }
-
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr,
@@ -1653,32 +1535,22 @@ class CallInst : public CallBase {
CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
}
- static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- const int NumOperands =
- ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
- const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
-
- return new (NumOperands, DescriptorBytes)
- CallInst(Ty, Func, Args, Bundles, NameStr, InsertBefore);
- }
-
- static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertAtEnd);
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new (ComputeNumOperands(Args.size()))
CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertAtEnd);
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
const int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -1693,12 +1565,6 @@ class CallInst : public CallBase {
InsertBefore);
}
- static CallInst *Create(FunctionCallee Func, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), NameStr,
- InsertBefore);
- }
-
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
const Twine &NameStr,
@@ -1707,14 +1573,6 @@ class CallInst : public CallBase {
NameStr, InsertBefore);
}
- static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
- NameStr, InsertBefore);
- }
-
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
const Twine &NameStr,
BasicBlock::iterator InsertBefore) {
@@ -1722,28 +1580,23 @@ class CallInst : public CallBase {
InsertBefore);
}
- static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), Args, NameStr,
- InsertBefore);
- }
-
- static CallInst *Create(FunctionCallee Func, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ static CallInst *Create(FunctionCallee Func, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), NameStr,
InsertAtEnd);
}
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, NameStr,
InsertAtEnd);
}
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
NameStr, InsertAtEnd);
}
@@ -1756,8 +1609,7 @@ class CallInst : public CallBase {
/// in \p Bundles.
static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
- static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles);
// Note that 'musttail' implies 'tail'.
enum TailCallKind : unsigned {
@@ -1840,17 +1692,6 @@ CallInst::CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
init(Ty, Func, Args, Bundles, NameStr);
}
-CallInst::CallInst(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr,
- Instruction *InsertBefore)
- : CallBase(Ty->getReturnType(), Instruction::Call,
- OperandTraits<CallBase>::op_end(this) -
- (Args.size() + CountBundleInputs(Bundles) + 1),
- unsigned(Args.size() + CountBundleInputs(Bundles) + 1),
- InsertBefore) {
- init(Ty, Func, Args, Bundles, NameStr);
-}
-
//===----------------------------------------------------------------------===//
// SelectInst Class
//===----------------------------------------------------------------------===//
@@ -1866,14 +1707,6 @@ class SelectInst : public Instruction {
setName(NameStr);
}
- SelectInst(Value *C, Value *S1, Value *S2, const Twine &NameStr,
- Instruction *InsertBefore)
- : Instruction(S1->getType(), Instruction::Select,
- &Op<0>(), 3, InsertBefore) {
- init(C, S1, S2);
- setName(NameStr);
- }
-
SelectInst(Value *C, Value *S1, Value *S2, const Twine &NameStr,
BasicBlock *InsertAtEnd)
: Instruction(S1->getType(), Instruction::Select,
@@ -1908,20 +1741,14 @@ class SelectInst : public Instruction {
static SelectInst *Create(Value *C, Value *S1, Value *S2,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr,
+ BasicBlock *InsertAtEnd = nullptr,
Instruction *MDFrom = nullptr) {
- SelectInst *Sel = new(3) SelectInst(C, S1, S2, NameStr, InsertBefore);
+ SelectInst *Sel = new (3) SelectInst(C, S1, S2, NameStr, InsertAtEnd);
if (MDFrom)
Sel->copyMetadata(*MDFrom);
return Sel;
}
- static SelectInst *Create(Value *C, Value *S1, Value *S2,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
- return new(3) SelectInst(C, S1, S2, NameStr, InsertAtEnd);
- }
-
const Value *getCondition() const { return Op<0>(); }
const Value *getTrueValue() const { return Op<1>(); }
const Value *getFalseValue() const { return Op<2>(); }
@@ -1985,14 +1812,8 @@ class VAArgInst : public UnaryInstruction {
}
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr)
- : UnaryInstruction(Ty, VAArg, List, InsertBefore) {
- setName(NameStr);
- }
-
- VAArgInst(Value *List, Type *Ty, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
- : UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr)
+ : UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
setName(NameStr);
}
@@ -2020,9 +1841,7 @@ class ExtractElementInst : public Instruction {
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -2038,14 +1857,8 @@ class ExtractElementInst : public Instruction {
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new(2) ExtractElementInst(Vec, Idx, NameStr, InsertBefore);
- }
-
- static ExtractElementInst *Create(Value *Vec, Value *Idx,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new(2) ExtractElementInst(Vec, Idx, NameStr, InsertAtEnd);
}
@@ -2093,9 +1906,7 @@ class InsertElementInst : public Instruction {
BasicBlock::iterator InsertBefore);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -2112,13 +1923,7 @@ class InsertElementInst : public Instruction {
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new(3) InsertElementInst(Vec, NewElt, Idx, NameStr, InsertBefore);
- }
-
- static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new(3) InsertElementInst(Vec, NewElt, Idx, NameStr, InsertAtEnd);
}
@@ -2182,29 +1987,21 @@ class ShuffleVectorInst : public Instruction {
ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr,
BasicBlock::iterator InsertBefor);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &NameStr = "",
- Instruction *InsertBefor = nullptr);
- ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &NameStr, BasicBlock::iterator InsertBefor);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &NameStr = "",
- Instruction *InsertBefor = nullptr);
- ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
void *operator new(size_t S) { return User::operator new(S, 2); }
void operator delete(void *Ptr) { return User::operator delete(Ptr); }
@@ -2704,18 +2501,9 @@ class ExtractValueInst : public UnaryInstruction {
ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);
}
- static ExtractValueInst *Create(Value *Agg,
- ArrayRef<unsigned> Idxs,
+ static ExtractValueInst *Create(Value *Agg, ArrayRef<unsigned> Idxs,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new
- ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);
- }
-
- static ExtractValueInst *Create(Value *Agg,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new ExtractValueInst(Agg, Idxs, NameStr, InsertAtEnd);
}
@@ -2772,15 +2560,6 @@ ExtractValueInst::ExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
init(Idxs, NameStr);
}
-ExtractValueInst::ExtractValueInst(Value *Agg,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- Instruction *InsertBefore)
- : UnaryInstruction(checkGEPType(getIndexedType(Agg->getType(), Idxs)),
- ExtractValue, Agg, InsertBefore) {
- init(Idxs, NameStr);
-}
-
ExtractValueInst::ExtractValueInst(Value *Agg,
ArrayRef<unsigned> Idxs,
const Twine &NameStr,
@@ -2809,10 +2588,6 @@ class InsertValueInst : public Instruction {
inline InsertValueInst(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- inline InsertValueInst(Value *Agg, Value *Val,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- Instruction *InsertBefore);
inline InsertValueInst(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@@ -2822,10 +2597,7 @@ class InsertValueInst : public Instruction {
InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr,
- BasicBlock *InsertAtEnd);
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
const Twine &NameStr);
@@ -2850,14 +2622,7 @@ class InsertValueInst : public Instruction {
static InsertValueInst *Create(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertBefore);
- }
-
- static InsertValueInst *Create(Value *Agg, Value *Val,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertAtEnd);
}
@@ -2928,17 +2693,6 @@ InsertValueInst::InsertValueInst(Value *Agg,
init(Agg, Val, Idxs, NameStr);
}
-InsertValueInst::InsertValueInst(Value *Agg,
- Value *Val,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- Instruction *InsertBefore)
- : Instruction(Agg->getType(), InsertValue,
- OperandTraits<InsertValueInst>::op_begin(this),
- 2, InsertBefore) {
- init(Agg, Val, Idxs, NameStr);
-}
-
InsertValueInst::InsertValueInst(Value *Agg,
Value *Val,
ArrayRef<unsigned> Idxs,
@@ -2977,19 +2731,9 @@ class PHINode : public Instruction {
}
explicit PHINode(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr)
- : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
- ReservedSpace(NumReservedValues) {
- assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
- setName(NameStr);
- allocHungoffUses(ReservedSpace);
- }
-
- PHINode(Type *Ty, unsigned NumReservedValues, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
- : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
- ReservedSpace(NumReservedValues) {
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr)
+ : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
+ ReservedSpace(NumReservedValues) {
assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
setName(NameStr);
allocHungoffUses(ReservedSpace);
@@ -3019,12 +2763,7 @@ class PHINode : public Instruction {
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
- }
-
- static PHINode *Create(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
}
@@ -3244,8 +2983,6 @@ class LandingPadInst : public Instruction {
explicit LandingPadInst(Type *RetTy, unsigned NumReservedValues,
const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- explicit LandingPadInst(Type *RetTy, unsigned NumReservedValues,
- const Twine &NameStr, Instruction *InsertBefore);
explicit LandingPadInst(Type *RetTy, unsigned NumReservedValues,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@@ -3271,9 +3008,7 @@ class LandingPadInst : public Instruction {
BasicBlock::iterator InsertBefore);
static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -3355,8 +3090,7 @@ class ReturnInst : public Instruction {
explicit ReturnInst(LLVMContext &C, Value *retVal,
BasicBlock::iterator InsertBefore);
explicit ReturnInst(LLVMContext &C, Value *retVal = nullptr,
- Instruction *InsertBefore = nullptr);
- ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
protected:
@@ -3371,13 +3105,8 @@ class ReturnInst : public Instruction {
return new (!!retVal) ReturnInst(C, retVal, InsertBefore);
}
- static ReturnInst* Create(LLVMContext &C, Value *retVal = nullptr,
- Instruction *InsertBefore = nullptr) {
- return new(!!retVal) ReturnInst(C, retVal, InsertBefore);
- }
-
- static ReturnInst* Create(LLVMContext &C, Value *retVal,
- BasicBlock *InsertAtEnd) {
+ static ReturnInst *Create(LLVMContext &C, Value *retVal = nullptr,
+ BasicBlock *InsertAtEnd = nullptr) {
return new(!!retVal) ReturnInst(C, retVal, InsertAtEnd);
}
@@ -3444,12 +3173,9 @@ class BranchInst : public Instruction {
explicit BranchInst(BasicBlock *IfTrue, BasicBlock::iterator InsertBefore);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock::iterator InsertBefore);
- explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = nullptr);
+ BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd = nullptr);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- Instruction *InsertBefore = nullptr);
- BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd);
- BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
void AssertOK();
@@ -3492,27 +3218,18 @@ class BranchInst : public Instruction {
return new(1) BranchInst(IfTrue, InsertBefore);
}
- static BranchInst *Create(BasicBlock *IfTrue,
- Instruction *InsertBefore = nullptr) {
- return new(1) BranchInst(IfTrue, InsertBefore);
- }
-
static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *IfFalse,
Value *Cond, BasicBlock::iterator InsertBefore) {
return new(3) BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
}
- static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *IfFalse,
- Value *Cond, Instruction *InsertBefore = nullptr) {
- return new(3) BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
- }
-
- static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd) {
+ static BranchInst *Create(BasicBlock *IfTrue,
+ BasicBlock *InsertAtEnd = nullptr) {
return new(1) BranchInst(IfTrue, InsertAtEnd);
}
static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *IfFalse,
- Value *Cond, BasicBlock *InsertAtEnd) {
+ Value *Cond, BasicBlock *InsertAtEnd = nullptr) {
return new(3) BranchInst(IfTrue, IfFalse, Cond, InsertAtEnd);
}
@@ -3601,13 +3318,6 @@ class SwitchInst : public Instruction {
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
BasicBlock::iterator InsertBefore);
- /// Create a new switch instruction, specifying a value to switch on and a
- /// default destination. The number of additional cases can be specified here
- /// to make memory allocation more efficient. This constructor can also
- /// auto-insert before another instruction.
- SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
- Instruction *InsertBefore);
-
/// Create a new switch instruction, specifying a value to switch on and a
/// default destination. The number of additional cases can be specified here
/// to make memory allocation more efficient. This constructor also
@@ -3789,12 +3499,7 @@ class SwitchInst : public Instruction {
static SwitchInst *Create(Value *Value, BasicBlock *Default,
unsigned NumCases,
- Instruction *InsertBefore = nullptr) {
- return new SwitchInst(Value, Default, NumCases, InsertBefore);
- }
-
- static SwitchInst *Create(Value *Value, BasicBlock *Default,
- unsigned NumCases, BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
}
@@ -4014,12 +3719,6 @@ class IndirectBrInst : public Instruction {
IndirectBrInst(Value *Address, unsigned NumDests,
BasicBlock::iterator InsertBefore);
- /// Create a new indirectbr instruction, specifying an
- /// Address to jump to. The number of expected destinations can be specified
- /// here to make memory allocation more efficient. This constructor can also
- /// autoinsert before another instruction.
- IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
-
/// Create a new indirectbr instruction, specifying an
/// Address to jump to. The number of expected destinations can be specified
/// here to make memory allocation more efficient. This constructor also
@@ -4074,12 +3773,7 @@ class IndirectBrInst : public Instruction {
}
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- Instruction *InsertBefore = nullptr) {
- return new IndirectBrInst(Address, NumDests, InsertBefore);
- }
-
- static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new IndirectBrInst(Address, NumDests, InsertAtEnd);
}
@@ -4166,14 +3860,6 @@ class InvokeInst : public CallBase {
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
const Twine &NameStr, BasicBlock::iterator InsertBefore);
- /// Construct an InvokeInst given a range of arguments.
- ///
- /// Construct an InvokeInst from a range of arguments
- inline InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, int NumOperands,
- const Twine &NameStr, Instruction *InsertBefore);
-
inline InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
@@ -4207,16 +3893,6 @@ class InvokeInst : public CallBase {
NumOperands, NameStr, InsertBefore);
}
- static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- int NumOperands = ComputeNumOperands(Args.size());
- return new (NumOperands)
- InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
- NumOperands, NameStr, InsertBefore);
- }
-
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
@@ -4233,21 +3909,8 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- int NumOperands =
- ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
- unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
-
- return new (NumOperands, DescriptorBytes)
- InvokeInst(Ty, Func, IfNormal, IfException, Args, Bundles, NumOperands,
- NameStr, InsertBefore);
- }
-
- static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size());
return new (NumOperands)
InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
@@ -4257,7 +3920,8 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4275,14 +3939,6 @@ class InvokeInst : public CallBase {
IfException, Args, std::nullopt, NameStr, InsertBefore);
}
- static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
- IfException, Args, std::nullopt, NameStr, InsertBefore);
- }
-
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
@@ -4294,16 +3950,8 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
- IfException, Args, Bundles, NameStr, InsertBefore);
- }
-
- static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, NameStr, InsertAtEnd);
}
@@ -4311,7 +3959,8 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4324,8 +3973,8 @@ class InvokeInst : public CallBase {
/// bundles in \p Bundles.
static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
- static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+
+ static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles);
// get*Dest - Return the destination basic blocks...
BasicBlock *getNormalDest() const {
@@ -4387,16 +4036,6 @@ InvokeInst::InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
}
-InvokeInst::InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, int NumOperands,
- const Twine &NameStr, Instruction *InsertBefore)
- : CallBase(Ty->getReturnType(), Instruction::Invoke,
- OperandTraits<CallBase>::op_end(this) - NumOperands, NumOperands,
- InsertBefore) {
- init(Ty, Func, IfNormal, IfException, Args, Bundles, NameStr);
-}
-
InvokeInst::InvokeInst(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
@@ -4429,14 +4068,6 @@ class CallBrInst : public CallBase {
BasicBlock::iterator InsertBefore);
/// Construct a CallBrInst given a range of arguments.
- ///
- /// Construct a CallBrInst from a range of arguments
- inline CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, int NumOperands,
- const Twine &NameStr, Instruction *InsertBefore);
-
inline CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
@@ -4473,17 +4104,6 @@ class CallBrInst : public CallBase {
NumOperands, NameStr, InsertBefore);
}
- static CallBrInst *Create(FunctionType *Ty, Value *Func,
- BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args, const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size());
- return new (NumOperands)
- CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, std::nullopt,
- NumOperands, NameStr, InsertBefore);
- }
-
static CallBrInst *
Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
@@ -4498,37 +4118,22 @@ class CallBrInst : public CallBase {
NumOperands, NameStr, InsertBefore);
}
- static CallBrInst *
- Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "", Instruction *InsertBefore = nullptr) {
- int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
- CountBundleInputs(Bundles));
- unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
-
- return new (NumOperands, DescriptorBytes)
- CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, Bundles,
- NumOperands, NameStr, InsertBefore);
- }
-
static CallBrInst *Create(FunctionType *Ty, Value *Func,
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ ArrayRef<Value *> Args, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size());
return new (NumOperands)
CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, std::nullopt,
NumOperands, NameStr, InsertAtEnd);
}
- static CallBrInst *Create(FunctionType *Ty, Value *Func,
- BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ static CallBrInst *
+ Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
+ ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4546,14 +4151,6 @@ class CallBrInst : public CallBase {
IndirectDests, Args, NameStr, InsertBefore);
}
- static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args, const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
- IndirectDests, Args, NameStr, InsertBefore);
- }
-
static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
@@ -4566,28 +4163,18 @@ class CallBrInst : public CallBase {
static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
- IndirectDests, Args, Bundles, NameStr, InsertBefore);
- }
-
- static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ ArrayRef<Value *> Args, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, NameStr, InsertAtEnd);
}
- static CallBrInst *Create(FunctionCallee Func,
- BasicBlock *DefaultDest,
+ static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4601,8 +4188,7 @@ class CallBrInst : public CallBase {
static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
static CallBrInst *Create(CallBrInst *CBI,
- ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ ArrayRef<OperandBundleDef> Bundles);
/// Return the number of callbr indirect dest labels.
///
@@ -4682,17 +4268,6 @@ CallBrInst::CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);
}
-CallBrInst::CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, int NumOperands,
- const Twine &NameStr, Instruction *InsertBefore)
- : CallBase(Ty->getReturnType(), Instruction::CallBr,
- OperandTraits<CallBase>::op_end(this) - NumOperands, NumOperands,
- InsertBefore) {
- init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);
-}
-
CallBrInst::CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
@@ -4714,7 +4289,6 @@ CallBrInst::CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
class ResumeInst : public Instruction {
ResumeInst(const ResumeInst &RI);
- explicit ResumeInst(Value *Exn, Instruction *InsertBefore=nullptr);
explicit ResumeInst(Value *Exn, BasicBlock::iterator InsertBefore);
ResumeInst(Value *Exn, BasicBlock *InsertAtEnd);
@@ -4729,11 +4303,7 @@ class ResumeInst : public Instruction {
return new (1) ResumeInst(Exn, InsertBefore);
}
- static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = nullptr) {
- return new(1) ResumeInst(Exn, InsertBefore);
- }
-
- static ResumeInst *Create(Value *Exn, BasicBlock *InsertAtEnd) {
+ static ResumeInst *Create(Value *Exn, BasicBlock *InsertAtEnd = nullptr) {
return new(1) ResumeInst(Exn, InsertAtEnd);
}
@@ -4793,14 +4363,6 @@ class CatchSwitchInst : public Instruction {
unsigned NumHandlers, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- /// Create a new switch instruction, specifying a
- /// default destination. The number of additional handlers can be specified
- /// here to make memory allocation more efficient.
- /// This constructor can also autoinsert before another instruction.
- CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers, const Twine &NameStr,
- Instruction *InsertBefore);
-
/// Create a new switch instruction, specifying a
/// default destination. The number of additional handlers can be specified
/// here to make memory allocation more efficient.
@@ -4834,14 +4396,7 @@ class CatchSwitchInst : public Instruction {
static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
unsigned NumHandlers,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
- InsertBefore);
- }
-
- static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
InsertAtEnd);
}
@@ -4973,11 +4528,6 @@ class CleanupPadInst : public FuncletPadInst {
BasicBlock::iterator InsertBefore)
: FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
NameStr, InsertBefore) {}
- explicit CleanupPadInst(Value *ParentPad, ArrayRef<Value *> Args,
- unsigned Values, const Twine &NameStr,
- Instruction *InsertBefore)
- : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
- NameStr, InsertBefore) {}
explicit CleanupPadInst(Value *ParentPad, ArrayRef<Value *> Args,
unsigned Values, const Twine &NameStr,
BasicBlock *InsertAtEnd)
@@ -4993,17 +4543,9 @@ class CleanupPadInst : public FuncletPadInst {
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertBefore);
}
- static CleanupPadInst *Create(Value *ParentPad,
- ArrayRef<Value *> Args = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- unsigned Values = 1 + Args.size();
- return new (Values)
- CleanupPadInst(ParentPad, Args, Values, NameStr, InsertBefore);
- }
-
static CleanupPadInst *Create(Value *ParentPad, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertAtEnd);
@@ -5028,11 +4570,6 @@ class CatchPadInst : public FuncletPadInst {
BasicBlock::iterator InsertBefore)
: FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
NameStr, InsertBefore) {}
- explicit CatchPadInst(Value *CatchSwitch, ArrayRef<Value *> Args,
- unsigned Values, const Twine &NameStr,
- Instruction *InsertBefore)
- : FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
- NameStr, InsertBefore) {}
explicit CatchPadInst(Value *CatchSwitch, ArrayRef<Value *> Args,
unsigned Values, const Twine &NameStr,
BasicBlock *InsertAtEnd)
@@ -5050,14 +4587,7 @@ class CatchPadInst : public FuncletPadInst {
static CatchPadInst *Create(Value *CatchSwitch, ArrayRef<Value *> Args,
const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
- unsigned Values = 1 + Args.size();
- return new (Values)
- CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertBefore);
- }
-
- static CatchPadInst *Create(Value *CatchSwitch, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
@@ -5089,7 +4619,6 @@ class CatchReturnInst : public Instruction {
CatchReturnInst(const CatchReturnInst &RI);
CatchReturnInst(Value *CatchPad, BasicBlock *BB,
BasicBlock::iterator InsertBefore);
- CatchReturnInst(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore);
CatchReturnInst(Value *CatchPad, BasicBlock *BB, BasicBlock *InsertAtEnd);
void init(Value *CatchPad, BasicBlock *BB);
@@ -5109,14 +4638,7 @@ class CatchReturnInst : public Instruction {
}
static CatchReturnInst *Create(Value *CatchPad, BasicBlock *BB,
- Instruction *InsertBefore = nullptr) {
- assert(CatchPad);
- assert(BB);
- return new (2) CatchReturnInst(CatchPad, BB, InsertBefore);
- }
-
- static CatchReturnInst *Create(Value *CatchPad, BasicBlock *BB,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
assert(CatchPad);
assert(BB);
return new (2) CatchReturnInst(CatchPad, BB, InsertAtEnd);
@@ -5182,8 +4704,6 @@ class CleanupReturnInst : public Instruction {
CleanupReturnInst(const CleanupReturnInst &RI);
CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
BasicBlock::iterator InsertBefore);
- CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
- Instruction *InsertBefore = nullptr);
CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
BasicBlock *InsertAtEnd);
@@ -5208,17 +4728,7 @@ class CleanupReturnInst : public Instruction {
static CleanupReturnInst *Create(Value *CleanupPad,
BasicBlock *UnwindBB = nullptr,
- Instruction *InsertBefore = nullptr) {
- assert(CleanupPad);
- unsigned Values = 1;
- if (UnwindBB)
- ++Values;
- return new (Values)
- CleanupReturnInst(CleanupPad, UnwindBB, Values, InsertBefore);
- }
-
- static CleanupReturnInst *Create(Value *CleanupPad, BasicBlock *UnwindBB,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
assert(CleanupPad);
unsigned Values = 1;
if (UnwindBB)
@@ -5304,8 +4814,7 @@ class UnreachableInst : public Instruction {
public:
explicit UnreachableInst(LLVMContext &C, BasicBlock::iterator InsertBefore);
- explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = nullptr);
- explicit UnreachableInst(LLVMContext &C, BasicBlock *InsertAtEnd);
+ explicit UnreachableInst(LLVMContext &C, BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, 0); }
@@ -5353,20 +4862,12 @@ class TruncInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- TruncInst(
- Value *S, ///< The value to be truncated
- Type *Ty, ///< The (smaller) type to truncate to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- TruncInst(
- Value *S, ///< The value to be truncated
- Type *Ty, ///< The (smaller) type to truncate to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ TruncInst(Value *S, ///< The value to be truncated
+ Type *Ty, ///< The (smaller) type to truncate to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5400,20 +4901,12 @@ class ZExtInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- ZExtInst(
- Value *S, ///< The value to be zero extended
- Type *Ty, ///< The type to zero extend to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end semantics.
- ZExtInst(
- Value *S, ///< The value to be zero extended
- Type *Ty, ///< The type to zero extend to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ ZExtInst(Value *S, ///< The value to be zero extended
+ Type *Ty, ///< The type to zero extend to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5447,20 +4940,12 @@ class SExtInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- SExtInst(
- Value *S, ///< The value to be sign extended
- Type *Ty, ///< The type to sign extend to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- SExtInst(
- Value *S, ///< The value to be sign extended
- Type *Ty, ///< The type to sign extend to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ SExtInst(Value *S, ///< The value to be sign extended
+ Type *Ty, ///< The type to sign extend to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5495,19 +4980,11 @@ class FPTruncInst : public CastInst {
);
/// Constructor with insert-before-instruction semantics
- FPTruncInst(
- Value *S, ///< The value to be truncated
- Type *Ty, ///< The type to truncate to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
- /// Constructor with insert-before-instruction semantics
- FPTruncInst(
- Value *S, ///< The value to be truncated
- Type *Ty, ///< The type to truncate to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ FPTruncInst(Value *S, ///< The value to be truncated
+ Type *Ty, ///< The type to truncate to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5541,20 +5018,12 @@ class FPExtInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- FPExtInst(
- Value *S, ///< The value to be extended
- Type *Ty, ///< The type to extend to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- FPExtInst(
- Value *S, ///< The value to be extended
- Type *Ty, ///< The type to extend to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ FPExtInst(Value *S, ///< The value to be extended
+ Type *Ty, ///< The type to extend to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5588,20 +5057,12 @@ class UIToFPInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- UIToFPInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- UIToFPInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ UIToFPInst(Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5635,20 +5096,12 @@ class SIToFPInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- SIToFPInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- SIToFPInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ SIToFPInst(Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5682,20 +5135,12 @@ class FPToUIInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- FPToUIInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
FPToUIInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< Where to insert the new instruction
+ Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd = nullptr ///< Where to insert the new instruction
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5729,20 +5174,12 @@ class FPToSIInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- FPToSIInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- FPToSIInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ FPToSIInst(Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5772,20 +5209,12 @@ class IntToPtrInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- IntToPtrInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- IntToPtrInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ IntToPtrInst(Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Clone an identical IntToPtrInst.
@@ -5827,20 +5256,12 @@ class PtrToIntInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- PtrToIntInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- PtrToIntInst(
- Value *S, ///< The value to be converted
- Type *Ty, ///< The type to convert to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ PtrToIntInst(Value *S, ///< The value to be converted
+ Type *Ty, ///< The type to convert to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
/// Gets the pointer operand.
@@ -5886,20 +5307,12 @@ class BitCastInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- BitCastInst(
- Value *S, ///< The value to be casted
- Type *Ty, ///< The type to casted to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
- BitCastInst(
- Value *S, ///< The value to be casted
- Type *Ty, ///< The type to casted to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ BitCastInst(Value *S, ///< The value to be casted
+ Type *Ty, ///< The type to casted to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5934,20 +5347,13 @@ class AddrSpaceCastInst : public CastInst {
BasicBlock::iterator InsertBefore ///< Where to insert the new instruction
);
- /// Constructor with insert-before-instruction semantics
- AddrSpaceCastInst(
- Value *S, ///< The value to be casted
- Type *Ty, ///< The type to casted to
- const Twine &NameStr = "", ///< A name for the new instruction
- Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
- );
-
/// Constructor with insert-at-end-of-block semantics
AddrSpaceCastInst(
- Value *S, ///< The value to be casted
- Type *Ty, ///< The type to casted to
- const Twine &NameStr, ///< A name for the new instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ Value *S, ///< The value to be casted
+ Type *Ty, ///< The type to casted to
+ const Twine &NameStr = "", ///< A name for the new instruction
+ BasicBlock *InsertAtEnd =
+ nullptr ///< Block to insert the instruction into
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -6078,10 +5484,8 @@ class FreezeInst : public UnaryInstruction {
public:
explicit FreezeInst(Value *S, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- explicit FreezeInst(Value *S,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
- FreezeInst(Value *S, const Twine &NameStr, BasicBlock *InsertAtEnd);
+ FreezeInst(Value *S, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *I) {
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 9744eb32d27a5e..252f77a2244c2f 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -32,18 +32,6 @@ Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
insertInto(BB, InsertBefore);
}
-Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
- Instruction *InsertBefore)
- : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
-
- // If requested, insert this instruction into a basic block...
- if (InsertBefore) {
- BasicBlock *BB = InsertBefore->getParent();
- assert(BB && "Instruction to insert before is not in a basic block!");
- insertInto(BB, InsertBefore->getIterator());
- }
-}
-
Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index c55d6cff84ed55..e2f5faf795bf6c 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -237,12 +237,6 @@ LandingPadInst::LandingPadInst(Type *RetTy, unsigned NumReservedValues,
init(NumReservedValues, NameStr);
}
-LandingPadInst::LandingPadInst(Type *RetTy, unsigned NumReservedValues,
- const Twine &NameStr, Instruction *InsertBefore)
- : Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertBefore) {
- init(NumReservedValues, NameStr);
-}
-
LandingPadInst::LandingPadInst(Type *RetTy, unsigned NumReservedValues,
const Twine &NameStr, BasicBlock *InsertAtEnd)
: Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertAtEnd) {
@@ -264,7 +258,7 @@ LandingPadInst::LandingPadInst(const LandingPadInst &LP)
LandingPadInst *LandingPadInst::Create(Type *RetTy, unsigned NumReservedClauses,
const Twine &NameStr,
- Instruction *InsertBefore) {
+ BasicBlock::iterator InsertBefore) {
return new LandingPadInst(RetTy, NumReservedClauses, NameStr, InsertBefore);
}
@@ -317,22 +311,21 @@ CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
}
}
-CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt) {
+CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles) {
switch (CB->getOpcode()) {
case Instruction::Call:
- return CallInst::Create(cast<CallInst>(CB), Bundles, InsertPt);
+ return CallInst::Create(cast<CallInst>(CB), Bundles);
case Instruction::Invoke:
- return InvokeInst::Create(cast<InvokeInst>(CB), Bundles, InsertPt);
+ return InvokeInst::Create(cast<InvokeInst>(CB), Bundles);
case Instruction::CallBr:
- return CallBrInst::Create(cast<CallBrInst>(CB), Bundles, InsertPt);
+ return CallBrInst::Create(cast<CallBrInst>(CB), Bundles);
default:
llvm_unreachable("Unknown CallBase sub-class!");
}
}
CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
- Instruction *InsertPt) {
+ BasicBlock::iterator InsertPt) {
SmallVector<OperandBundleDef, 2> OpDefs;
for (unsigned i = 0, e = CI->getNumOperandBundles(); i < e; ++i) {
auto ChildOB = CI->getOperandBundleAt(i);
@@ -343,6 +336,16 @@ CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
return CallBase::Create(CI, OpDefs, InsertPt);
}
+CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB) {
+ SmallVector<OperandBundleDef, 2> OpDefs;
+ for (unsigned i = 0, e = CI->getNumOperandBundles(); i < e; ++i) {
+ auto ChildOB = CI->getOperandBundleAt(i);
+ if (ChildOB.getTagName() != OpB.getTag())
+ OpDefs.emplace_back(ChildOB);
+ }
+ OpDefs.emplace_back(OpB);
+ return CallBase::Create(CI, OpDefs);
+}
Function *CallBase::getCaller() { return getParent()->getParent(); }
@@ -584,15 +587,14 @@ CallBase *CallBase::addOperandBundle(CallBase *CB, uint32_t ID,
}
CallBase *CallBase::addOperandBundle(CallBase *CB, uint32_t ID,
- OperandBundleDef OB,
- Instruction *InsertPt) {
+ OperandBundleDef OB) {
if (CB->getOperandBundle(ID))
return CB;
SmallVector<OperandBundleDef, 1> Bundles;
CB->getOperandBundlesAsDefs(Bundles);
Bundles.push_back(OB);
- return Create(CB, Bundles, InsertPt);
+ return Create(CB, Bundles);
}
CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
@@ -612,8 +614,7 @@ CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
return CreateNew ? Create(CB, Bundles, InsertPt) : CB;
}
-CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
- Instruction *InsertPt) {
+CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID) {
SmallVector<OperandBundleDef, 1> Bundles;
bool CreateNew = false;
@@ -626,7 +627,7 @@ CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
Bundles.emplace_back(Bundle);
}
- return CreateNew ? Create(CB, Bundles, InsertPt) : CB;
+ return CreateNew ? Create(CB, Bundles) : CB;
}
bool CallBase::hasReadingOperandBundles() const {
@@ -766,13 +767,6 @@ CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name,
init(Ty, Func, Name);
}
-CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name,
- Instruction *InsertBefore)
- : CallBase(Ty->getReturnType(), Instruction::Call,
- OperandTraits<CallBase>::op_end(this) - 1, 1, InsertBefore) {
- init(Ty, Func, Name);
-}
-
CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name,
BasicBlock *InsertAtEnd)
: CallBase(Ty->getReturnType(), Instruction::Call,
@@ -807,12 +801,11 @@ CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
return NewCI;
}
-CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
- Instruction *InsertPt) {
+CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB) {
std::vector<Value *> Args(CI->arg_begin(), CI->arg_end());
auto *NewCI = CallInst::Create(CI->getFunctionType(), CI->getCalledOperand(),
- Args, OpB, CI->getName(), InsertPt);
+ Args, OpB, CI->getName());
NewCI->setTailCallKind(CI->getTailCallKind());
NewCI->setCallingConv(CI->getCallingConv());
NewCI->SubclassOptionalData = CI->SubclassOptionalData;
@@ -944,13 +937,12 @@ InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
return NewII;
}
-InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
- Instruction *InsertPt) {
+InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB) {
std::vector<Value *> Args(II->arg_begin(), II->arg_end());
auto *NewII = InvokeInst::Create(
II->getFunctionType(), II->getCalledOperand(), II->getNormalDest(),
- II->getUnwindDest(), Args, OpB, II->getName(), InsertPt);
+ II->getUnwindDest(), Args, OpB, II->getName());
NewII->setCallingConv(II->getCallingConv());
NewII->SubclassOptionalData = II->SubclassOptionalData;
NewII->setAttributes(II->getAttributes());
@@ -1032,13 +1024,13 @@ CallBrInst *CallBrInst::Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> OpB,
return NewCBI;
}
-CallBrInst *CallBrInst::Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> OpB,
- Instruction *InsertPt) {
+CallBrInst *CallBrInst::Create(CallBrInst *CBI,
+ ArrayRef<OperandBundleDef> OpB) {
std::vector<Value *> Args(CBI->arg_begin(), CBI->arg_end());
auto *NewCBI = CallBrInst::Create(
CBI->getFunctionType(), CBI->getCalledOperand(), CBI->getDefaultDest(),
- CBI->getIndirectDests(), Args, OpB, CBI->getName(), InsertPt);
+ CBI->getIndirectDests(), Args, OpB, CBI->getName());
NewCBI->setCallingConv(CBI->getCallingConv());
NewCBI->SubclassOptionalData = CBI->SubclassOptionalData;
NewCBI->setAttributes(CBI->getAttributes());
@@ -1069,15 +1061,6 @@ ReturnInst::ReturnInst(LLVMContext &C, Value *retVal,
Op<0>() = retVal;
}
-ReturnInst::ReturnInst(LLVMContext &C, Value *retVal,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(C), Instruction::Ret,
- OperandTraits<ReturnInst>::op_end(this) - !!retVal, !!retVal,
- InsertBefore) {
- if (retVal)
- Op<0>() = retVal;
-}
-
ReturnInst::ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(C), Instruction::Ret,
OperandTraits<ReturnInst>::op_end(this) - !!retVal, !!retVal,
@@ -1106,12 +1089,6 @@ ResumeInst::ResumeInst(Value *Exn, BasicBlock::iterator InsertBefore)
Op<0>() = Exn;
}
-ResumeInst::ResumeInst(Value *Exn, Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(Exn->getContext()), Instruction::Resume,
- OperandTraits<ResumeInst>::op_begin(this), 1, InsertBefore) {
- Op<0>() = Exn;
-}
-
ResumeInst::ResumeInst(Value *Exn, BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(Exn->getContext()), Instruction::Resume,
OperandTraits<ResumeInst>::op_begin(this), 1, InsertAtEnd) {
@@ -1153,15 +1130,6 @@ CleanupReturnInst::CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
init(CleanupPad, UnwindBB);
}
-CleanupReturnInst::CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
- unsigned Values, Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(CleanupPad->getContext()),
- Instruction::CleanupRet,
- OperandTraits<CleanupReturnInst>::op_end(this) - Values,
- Values, InsertBefore) {
- init(CleanupPad, UnwindBB);
-}
-
CleanupReturnInst::CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
unsigned Values, BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(CleanupPad->getContext()),
@@ -1194,14 +1162,6 @@ CatchReturnInst::CatchReturnInst(Value *CatchPad, BasicBlock *BB,
init(CatchPad, BB);
}
-CatchReturnInst::CatchReturnInst(Value *CatchPad, BasicBlock *BB,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(BB->getContext()), Instruction::CatchRet,
- OperandTraits<CatchReturnInst>::op_begin(this), 2,
- InsertBefore) {
- init(CatchPad, BB);
-}
-
CatchReturnInst::CatchReturnInst(Value *CatchPad, BasicBlock *BB,
BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(BB->getContext()), Instruction::CatchRet,
@@ -1226,18 +1186,6 @@ CatchSwitchInst::CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
setName(NameStr);
}
-CatchSwitchInst::CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumReservedValues,
- const Twine &NameStr,
- Instruction *InsertBefore)
- : Instruction(ParentPad->getType(), Instruction::CatchSwitch, nullptr, 0,
- InsertBefore) {
- if (UnwindDest)
- ++NumReservedValues;
- init(ParentPad, UnwindDest, NumReservedValues + 1);
- setName(NameStr);
-}
-
CatchSwitchInst::CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
unsigned NumReservedValues,
const Twine &NameStr, BasicBlock *InsertAtEnd)
@@ -1335,15 +1283,6 @@ FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
init(ParentPad, Args, NameStr);
}
-FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
- ArrayRef<Value *> Args, unsigned Values,
- const Twine &NameStr, Instruction *InsertBefore)
- : Instruction(ParentPad->getType(), Op,
- OperandTraits<FuncletPadInst>::op_end(this) - Values, Values,
- InsertBefore) {
- init(ParentPad, Args, NameStr);
-}
-
FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
ArrayRef<Value *> Args, unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd)
@@ -1361,10 +1300,6 @@ UnreachableInst::UnreachableInst(LLVMContext &Context,
BasicBlock::iterator InsertBefore)
: Instruction(Type::getVoidTy(Context), Instruction::Unreachable, nullptr,
0, InsertBefore) {}
-UnreachableInst::UnreachableInst(LLVMContext &Context,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(Context), Instruction::Unreachable, nullptr,
- 0, InsertBefore) {}
UnreachableInst::UnreachableInst(LLVMContext &Context, BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(Context), Instruction::Unreachable, nullptr,
0, InsertAtEnd) {}
@@ -1387,14 +1322,6 @@ BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock::iterator InsertBefore)
Op<-1>() = IfTrue;
}
-BranchInst::BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
- OperandTraits<BranchInst>::op_end(this) - 1, 1,
- InsertBefore) {
- assert(IfTrue && "Branch destination may not be null!");
- Op<-1>() = IfTrue;
-}
-
BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock::iterator InsertBefore)
: Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
@@ -1409,20 +1336,6 @@ BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
#endif
}
-BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
- OperandTraits<BranchInst>::op_end(this) - 3, 3,
- InsertBefore) {
- // Assign in order of operand index to make use-list order predictable.
- Op<-3>() = Cond;
- Op<-2>() = IfFalse;
- Op<-1>() = IfTrue;
-#ifndef NDEBUG
- AssertOK();
-#endif
-}
-
BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
OperandTraits<BranchInst>::op_end(this) - 1, 1, InsertAtEnd) {
@@ -1504,10 +1417,6 @@ AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
BasicBlock::iterator InsertBefore)
: AllocaInst(Ty, AddrSpace, /*ArraySize=*/nullptr, Name, InsertBefore) {}
-AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
- Instruction *InsertBefore)
- : AllocaInst(Ty, AddrSpace, /*ArraySize=*/nullptr, Name, InsertBefore) {}
-
AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
BasicBlock *InsertAtEnd)
: AllocaInst(Ty, AddrSpace, /*ArraySize=*/nullptr, Name, InsertAtEnd) {}
@@ -1518,12 +1427,6 @@ AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
computeAllocaDefaultAlign(Ty, InsertBefore), Name,
InsertBefore) {}
-AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
- const Twine &Name, Instruction *InsertBefore)
- : AllocaInst(Ty, AddrSpace, ArraySize,
- computeAllocaDefaultAlign(Ty, InsertBefore), Name,
- InsertBefore) {}
-
AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
const Twine &Name, BasicBlock *InsertAtEnd)
: AllocaInst(Ty, AddrSpace, ArraySize,
@@ -1541,17 +1444,6 @@ AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
setName(Name);
}
-AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
- Align Align, const Twine &Name,
- Instruction *InsertBefore)
- : UnaryInstruction(PointerType::get(Ty, AddrSpace), Alloca,
- getAISize(Ty->getContext(), ArraySize), InsertBefore),
- AllocatedType(Ty) {
- setAlignment(Align);
- assert(!Ty->isVoidTy() && "Cannot allocate void!");
- setName(Name);
-}
-
AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
Align Align, const Twine &Name, BasicBlock *InsertAtEnd)
: UnaryInstruction(PointerType::get(Ty, AddrSpace), Alloca,
@@ -1611,10 +1503,6 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name,
BasicBlock::iterator InsertBef)
: LoadInst(Ty, Ptr, Name, /*isVolatile=*/false, InsertBef) {}
-LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name,
- Instruction *InsertBef)
- : LoadInst(Ty, Ptr, Name, /*isVolatile=*/false, InsertBef) {}
-
LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name,
BasicBlock *InsertAE)
: LoadInst(Ty, Ptr, Name, /*isVolatile=*/false, InsertAE) {}
@@ -1624,11 +1512,6 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
: LoadInst(Ty, Ptr, Name, isVolatile,
computeLoadStoreDefaultAlign(Ty, InsertBef), InsertBef) {}
-LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
- Instruction *InsertBef)
- : LoadInst(Ty, Ptr, Name, isVolatile,
- computeLoadStoreDefaultAlign(Ty, InsertBef), InsertBef) {}
-
LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
BasicBlock *InsertAE)
: LoadInst(Ty, Ptr, Name, isVolatile,
@@ -1639,11 +1522,6 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
: LoadInst(Ty, Ptr, Name, isVolatile, Align, AtomicOrdering::NotAtomic,
SyncScope::System, InsertBef) {}
-LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
- Align Align, Instruction *InsertBef)
- : LoadInst(Ty, Ptr, Name, isVolatile, Align, AtomicOrdering::NotAtomic,
- SyncScope::System, InsertBef) {}
-
LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
Align Align, BasicBlock *InsertAE)
: LoadInst(Ty, Ptr, Name, isVolatile, Align, AtomicOrdering::NotAtomic,
@@ -1660,17 +1538,6 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
setName(Name);
}
-LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
- Align Align, AtomicOrdering Order, SyncScope::ID SSID,
- Instruction *InsertBef)
- : UnaryInstruction(Ty, Load, Ptr, InsertBef) {
- setVolatile(isVolatile);
- setAlignment(Align);
- setAtomic(Order, SSID);
- AssertOK();
- setName(Name);
-}
-
LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
Align Align, AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock *InsertAE)
@@ -1692,21 +1559,12 @@ void StoreInst::AssertOK() {
"Ptr must have pointer type!");
}
-StoreInst::StoreInst(Value *val, Value *addr, Instruction *InsertBefore)
- : StoreInst(val, addr, /*isVolatile=*/false, InsertBefore) {}
-
StoreInst::StoreInst(Value *val, Value *addr, BasicBlock *InsertAtEnd)
: StoreInst(val, addr, /*isVolatile=*/false, InsertAtEnd) {}
StoreInst::StoreInst(Value *val, Value *addr, BasicBlock::iterator InsertBefore)
: StoreInst(val, addr, /*isVolatile=*/false, InsertBefore) {}
-StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
- Instruction *InsertBefore)
- : StoreInst(val, addr, isVolatile,
- computeLoadStoreDefaultAlign(val->getType(), InsertBefore),
- InsertBefore) {}
-
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
BasicBlock *InsertAtEnd)
: StoreInst(val, addr, isVolatile,
@@ -1719,11 +1577,6 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
computeLoadStoreDefaultAlign(val->getType(), &*InsertBefore),
InsertBefore) {}
-StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
- Instruction *InsertBefore)
- : StoreInst(val, addr, isVolatile, Align, AtomicOrdering::NotAtomic,
- SyncScope::System, InsertBefore) {}
-
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
BasicBlock *InsertAtEnd)
: StoreInst(val, addr, isVolatile, Align, AtomicOrdering::NotAtomic,
@@ -1734,20 +1587,6 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
: StoreInst(val, addr, isVolatile, Align, AtomicOrdering::NotAtomic,
SyncScope::System, InsertBefore) {}
-StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
- AtomicOrdering Order, SyncScope::ID SSID,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(val->getContext()), Store,
- OperandTraits<StoreInst>::op_begin(this),
- OperandTraits<StoreInst>::operands(this), InsertBefore) {
- Op<0>() = val;
- Op<1>() = addr;
- setVolatile(isVolatile);
- setAlignment(Align);
- setAtomic(Order, SSID);
- AssertOK();
-}
-
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock *InsertAtEnd)
@@ -1814,19 +1653,6 @@ AtomicCmpXchgInst::AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
Init(Ptr, Cmp, NewVal, Alignment, SuccessOrdering, FailureOrdering, SSID);
}
-AtomicCmpXchgInst::AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
- Align Alignment,
- AtomicOrdering SuccessOrdering,
- AtomicOrdering FailureOrdering,
- SyncScope::ID SSID,
- Instruction *InsertBefore)
- : Instruction(
- StructType::get(Cmp->getType(), Type::getInt1Ty(Cmp->getContext())),
- AtomicCmpXchg, OperandTraits<AtomicCmpXchgInst>::op_begin(this),
- OperandTraits<AtomicCmpXchgInst>::operands(this), InsertBefore) {
- Init(Ptr, Cmp, NewVal, Alignment, SuccessOrdering, FailureOrdering, SSID);
-}
-
AtomicCmpXchgInst::AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
Align Alignment,
AtomicOrdering SuccessOrdering,
@@ -1876,15 +1702,6 @@ AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
Init(Operation, Ptr, Val, Alignment, Ordering, SSID);
}
-AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
- Align Alignment, AtomicOrdering Ordering,
- SyncScope::ID SSID, Instruction *InsertBefore)
- : Instruction(Val->getType(), AtomicRMW,
- OperandTraits<AtomicRMWInst>::op_begin(this),
- OperandTraits<AtomicRMWInst>::operands(this), InsertBefore) {
- Init(Operation, Ptr, Val, Alignment, Ordering, SSID);
-}
-
AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
Align Alignment, AtomicOrdering Ordering,
SyncScope::ID SSID, BasicBlock *InsertAtEnd)
@@ -1948,14 +1765,6 @@ FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
setSyncScopeID(SSID);
}
-FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
- SyncScope::ID SSID,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(C), Fence, nullptr, 0, InsertBefore) {
- setOrdering(Ordering);
- setSyncScopeID(SSID);
-}
-
FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SyncScope::ID SSID,
BasicBlock *InsertAtEnd)
@@ -2106,20 +1915,6 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
setName(Name);
}
-ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
- const Twine &Name,
- Instruction *InsertBef)
- : Instruction(cast<VectorType>(Val->getType())->getElementType(),
- ExtractElement,
- OperandTraits<ExtractElementInst>::op_begin(this),
- 2, InsertBef) {
- assert(isValidOperands(Val, Index) &&
- "Invalid extractelement instruction operands!");
- Op<0>() = Val;
- Op<1>() = Index;
- setName(Name);
-}
-
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
const Twine &Name,
BasicBlock *InsertAE)
@@ -2159,20 +1954,6 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
setName(Name);
}
-InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
- const Twine &Name,
- Instruction *InsertBef)
- : Instruction(Vec->getType(), InsertElement,
- OperandTraits<InsertElementInst>::op_begin(this),
- 3, InsertBef) {
- assert(isValidOperands(Vec, Elt, Index) &&
- "Invalid insertelement instruction operands!");
- Op<0>() = Vec;
- Op<1>() = Elt;
- Op<2>() = Index;
- setName(Name);
-}
-
InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
const Twine &Name,
BasicBlock *InsertAE)
@@ -2215,11 +1996,6 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name,
: ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
InsertBefore) {}
-ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name,
- Instruction *InsertBefore)
- : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
- InsertBefore) {}
-
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name,
BasicBlock *InsertAtEnd)
: ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
@@ -2231,12 +2007,6 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef<int> Mask,
: ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
InsertBefore) {}
-ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef<int> Mask,
- const Twine &Name,
- Instruction *InsertBefore)
- : ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
- InsertBefore) {}
-
ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef<int> Mask,
const Twine &Name, BasicBlock *InsertAtEnd)
: ShuffleVectorInst(V1, createPlaceholderForShuffleVector(V1), Mask, Name,
@@ -2261,25 +2031,6 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
setName(Name);
}
-ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &Name,
- Instruction *InsertBefore)
- : Instruction(
- VectorType::get(cast<VectorType>(V1->getType())->getElementType(),
- cast<VectorType>(Mask->getType())->getElementCount()),
- ShuffleVector, OperandTraits<ShuffleVectorInst>::op_begin(this),
- OperandTraits<ShuffleVectorInst>::operands(this), InsertBefore) {
- assert(isValidOperands(V1, V2, Mask) &&
- "Invalid shuffle vector instruction operands!");
-
- Op<0>() = V1;
- Op<1>() = V2;
- SmallVector<int, 16> MaskArr;
- getShuffleMask(cast<Constant>(Mask), MaskArr);
- setShuffleMask(MaskArr);
- setName(Name);
-}
-
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &Name, BasicBlock *InsertAtEnd)
: Instruction(
@@ -2314,22 +2065,6 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
setName(Name);
}
-ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &Name,
- Instruction *InsertBefore)
- : Instruction(
- VectorType::get(cast<VectorType>(V1->getType())->getElementType(),
- Mask.size(), isa<ScalableVectorType>(V1->getType())),
- ShuffleVector, OperandTraits<ShuffleVectorInst>::op_begin(this),
- OperandTraits<ShuffleVectorInst>::operands(this), InsertBefore) {
- assert(isValidOperands(V1, V2, Mask) &&
- "Invalid shuffle vector instruction operands!");
- Op<0>() = V1;
- Op<1>() = V2;
- setShuffleMask(Mask);
- setName(Name);
-}
-
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &Name, BasicBlock *InsertAtEnd)
: Instruction(
@@ -3150,15 +2885,6 @@ UnaryOperator::UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
AssertOK();
}
-UnaryOperator::UnaryOperator(UnaryOps iType, Value *S,
- Type *Ty, const Twine &Name,
- Instruction *InsertBefore)
- : UnaryInstruction(Ty, iType, S, InsertBefore) {
- Op<0>() = S;
- setName(Name);
- AssertOK();
-}
-
UnaryOperator::UnaryOperator(UnaryOps iType, Value *S,
Type *Ty, const Twine &Name,
BasicBlock *InsertAtEnd)
@@ -3173,16 +2899,10 @@ UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S, const Twine &Name,
return new UnaryOperator(Op, S, S->getType(), Name, InsertBefore);
}
-UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S,
- const Twine &Name,
- Instruction *InsertBefore) {
- return new UnaryOperator(Op, S, S->getType(), Name, InsertBefore);
-}
-
UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S,
const Twine &Name,
BasicBlock *InsertAtEnd) {
- UnaryOperator *Res = Create(Op, S, Name);
+ UnaryOperator *Res = new UnaryOperator(Op, S, S->getType(), Name, nullptr);
Res->insertInto(InsertAtEnd, InsertAtEnd->end());
return Res;
}
@@ -3219,19 +2939,6 @@ BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
AssertOK();
}
-BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
- Type *Ty, const Twine &Name,
- Instruction *InsertBefore)
- : Instruction(Ty, iType,
- OperandTraits<BinaryOperator>::op_begin(this),
- OperandTraits<BinaryOperator>::operands(this),
- InsertBefore) {
- Op<0>() = S1;
- Op<1>() = S2;
- setName(Name);
- AssertOK();
-}
-
BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
Type *Ty, const Twine &Name,
BasicBlock *InsertAtEnd)
@@ -3321,18 +3028,11 @@ BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
}
-BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
- const Twine &Name,
- Instruction *InsertBefore) {
- assert(S1->getType() == S2->getType() &&
- "Cannot create binary operator with two operands of differing type!");
- return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
-}
-
BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
const Twine &Name,
BasicBlock *InsertAtEnd) {
- BinaryOperator *Res = Create(Op, S1, S2, Name);
+ BinaryOperator *Res =
+ new BinaryOperator(Op, S1, S2, S1->getType(), Name, nullptr);
Res->insertInto(InsertAtEnd, InsertAtEnd->end());
return Res;
}
@@ -3352,20 +3052,15 @@ BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
Op->getType(), Name, InsertAtEnd);
}
-BinaryOperator *BinaryOperator::CreateNSWNeg(Value *Op, const Twine &Name,
- Instruction *InsertBefore) {
- Value *Zero = ConstantInt::get(Op->getType(), 0);
- return BinaryOperator::CreateNSWSub(Zero, Op, Name, InsertBefore);
-}
-
BinaryOperator *BinaryOperator::CreateNSWNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Value *Zero = ConstantInt::get(Op->getType(), 0);
return BinaryOperator::CreateNSWSub(Zero, Op, Name, InsertAtEnd);
}
-BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
- Instruction *InsertBefore) {
+BinaryOperator *
+BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
+ BasicBlock::iterator InsertBefore) {
Value *Zero = ConstantInt::get(Op->getType(), 0);
return BinaryOperator::CreateNUWSub(Zero, Op, Name, InsertBefore);
}
@@ -3383,13 +3078,6 @@ BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
Op->getType(), Name, InsertBefore);
}
-BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
- Instruction *InsertBefore) {
- Constant *C = Constant::getAllOnesValue(Op->getType());
- return new BinaryOperator(Instruction::Xor, Op, C,
- Op->getType(), Name, InsertBefore);
-}
-
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Constant *AllOnes = Constant::getAllOnesValue(Op->getType());
@@ -3725,28 +3413,6 @@ CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
}
}
-CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
- const Twine &Name, Instruction *InsertBefore) {
- assert(castIsValid(op, S, Ty) && "Invalid cast!");
- // Construct and return the appropriate CastInst subclass
- switch (op) {
- case Trunc: return new TruncInst (S, Ty, Name, InsertBefore);
- case ZExt: return new ZExtInst (S, Ty, Name, InsertBefore);
- case SExt: return new SExtInst (S, Ty, Name, InsertBefore);
- case FPTrunc: return new FPTruncInst (S, Ty, Name, InsertBefore);
- case FPExt: return new FPExtInst (S, Ty, Name, InsertBefore);
- case UIToFP: return new UIToFPInst (S, Ty, Name, InsertBefore);
- case SIToFP: return new SIToFPInst (S, Ty, Name, InsertBefore);
- case FPToUI: return new FPToUIInst (S, Ty, Name, InsertBefore);
- case FPToSI: return new FPToSIInst (S, Ty, Name, InsertBefore);
- case PtrToInt: return new PtrToIntInst (S, Ty, Name, InsertBefore);
- case IntToPtr: return new IntToPtrInst (S, Ty, Name, InsertBefore);
- case BitCast: return new BitCastInst (S, Ty, Name, InsertBefore);
- case AddrSpaceCast: return new AddrSpaceCastInst (S, Ty, Name, InsertBefore);
- default: llvm_unreachable("Invalid opcode provided");
- }
-}
-
CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
const Twine &Name, BasicBlock *InsertAtEnd) {
assert(castIsValid(op, S, Ty) && "Invalid cast!");
@@ -3776,14 +3442,6 @@ CastInst *CastInst::CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name,
return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreateZExtOrBitCast(Value *S, Type *Ty,
- const Twine &Name,
- Instruction *InsertBefore) {
- if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits())
- return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
- return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateZExtOrBitCast(Value *S, Type *Ty,
const Twine &Name,
BasicBlock *InsertAtEnd) {
@@ -3799,14 +3457,6 @@ CastInst *CastInst::CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name,
return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreateSExtOrBitCast(Value *S, Type *Ty,
- const Twine &Name,
- Instruction *InsertBefore) {
- if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits())
- return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
- return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateSExtOrBitCast(Value *S, Type *Ty,
const Twine &Name,
BasicBlock *InsertAtEnd) {
@@ -3822,14 +3472,6 @@ CastInst *CastInst::CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name,
return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreateTruncOrBitCast(Value *S, Type *Ty,
- const Twine &Name,
- Instruction *InsertBefore) {
- if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits())
- return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
- return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateTruncOrBitCast(Value *S, Type *Ty,
const Twine &Name,
BasicBlock *InsertAtEnd) {
@@ -3874,24 +3516,6 @@ CastInst *CastInst::CreatePointerCast(Value *S, Type *Ty, const Twine &Name,
return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertBefore);
}
-/// Create a BitCast or a PtrToInt cast instruction
-CastInst *CastInst::CreatePointerCast(Value *S, Type *Ty, const Twine &Name,
- Instruction *InsertBefore) {
- assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast");
- assert((Ty->isIntOrIntVectorTy() || Ty->isPtrOrPtrVectorTy()) &&
- "Invalid cast");
- assert(Ty->isVectorTy() == S->getType()->isVectorTy() && "Invalid cast");
- assert((!Ty->isVectorTy() ||
- cast<VectorType>(Ty)->getElementCount() ==
- cast<VectorType>(S->getType())->getElementCount()) &&
- "Invalid cast");
-
- if (Ty->isIntOrIntVectorTy())
- return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
-
- return CreatePointerBitCastOrAddrSpaceCast(S, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreatePointerBitCastOrAddrSpaceCast(
Value *S, Type *Ty,
const Twine &Name,
@@ -3916,17 +3540,6 @@ CastInst *CastInst::CreatePointerBitCastOrAddrSpaceCast(
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreatePointerBitCastOrAddrSpaceCast(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore) {
- assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast");
- assert(Ty->isPtrOrPtrVectorTy() && "Invalid cast");
-
- if (S->getType()->getPointerAddressSpace() != Ty->getPointerAddressSpace())
- return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
-
- return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
const Twine &Name,
BasicBlock::iterator InsertBefore) {
@@ -3939,14 +3552,13 @@ CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
}
CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
- const Twine &Name,
- Instruction *InsertBefore) {
+ const Twine &Name) {
if (S->getType()->isPointerTy() && Ty->isIntegerTy())
- return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
+ return Create(Instruction::PtrToInt, S, Ty, Name, nullptr);
if (S->getType()->isIntegerTy() && Ty->isPointerTy())
- return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
+ return Create(Instruction::IntToPtr, S, Ty, Name, nullptr);
- return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
+ return Create(Instruction::BitCast, S, Ty, Name, nullptr);
}
CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty, bool isSigned,
@@ -3963,20 +3575,6 @@ CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty, bool isSigned,
return Create(opcode, C, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty,
- bool isSigned, const Twine &Name,
- Instruction *InsertBefore) {
- assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() &&
- "Invalid integer cast");
- unsigned SrcBits = C->getType()->getScalarSizeInBits();
- unsigned DstBits = Ty->getScalarSizeInBits();
- Instruction::CastOps opcode =
- (SrcBits == DstBits ? Instruction::BitCast :
- (SrcBits > DstBits ? Instruction::Trunc :
- (isSigned ? Instruction::SExt : Instruction::ZExt)));
- return Create(opcode, C, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty,
bool isSigned, const Twine &Name,
BasicBlock *InsertAtEnd) {
@@ -4003,20 +3601,6 @@ CastInst *CastInst::CreateFPCast(Value *C, Type *Ty, const Twine &Name,
return Create(opcode, C, Ty, Name, InsertBefore);
}
-CastInst *CastInst::CreateFPCast(Value *C, Type *Ty,
- const Twine &Name,
- Instruction *InsertBefore) {
- assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
- "Invalid cast");
- unsigned SrcBits = C->getType()->getScalarSizeInBits();
- unsigned DstBits = Ty->getScalarSizeInBits();
- assert((C->getType() == Ty || SrcBits != DstBits) && "Invalid cast");
- Instruction::CastOps opcode =
- (SrcBits == DstBits ? Instruction::BitCast :
- (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
- return Create(opcode, C, Ty, Name, InsertBefore);
-}
-
CastInst *CastInst::CreateFPCast(Value *C, Type *Ty,
const Twine &Name,
BasicBlock *InsertAtEnd) {
@@ -4300,12 +3884,6 @@ TruncInst::TruncInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal Trunc");
}
-TruncInst::TruncInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, Trunc, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal Trunc");
-}
-
TruncInst::TruncInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, Trunc, S, Name, InsertAtEnd) {
@@ -4318,12 +3896,6 @@ ZExtInst::ZExtInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal ZExt");
}
-ZExtInst::ZExtInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, ZExt, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal ZExt");
-}
-
ZExtInst::ZExtInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, ZExt, S, Name, InsertAtEnd) {
@@ -4336,12 +3908,6 @@ SExtInst::SExtInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal SExt");
}
-SExtInst::SExtInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, SExt, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal SExt");
-}
-
SExtInst::SExtInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, SExt, S, Name, InsertAtEnd) {
@@ -4354,12 +3920,6 @@ FPTruncInst::FPTruncInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPTrunc");
}
-FPTruncInst::FPTruncInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, FPTrunc, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPTrunc");
-}
-
FPTruncInst::FPTruncInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, FPTrunc, S, Name, InsertAtEnd) {
@@ -4372,12 +3932,6 @@ FPExtInst::FPExtInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPExt");
}
-FPExtInst::FPExtInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, FPExt, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPExt");
-}
-
FPExtInst::FPExtInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, FPExt, S, Name, InsertAtEnd) {
@@ -4390,12 +3944,6 @@ UIToFPInst::UIToFPInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal UIToFP");
}
-UIToFPInst::UIToFPInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, UIToFP, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal UIToFP");
-}
-
UIToFPInst::UIToFPInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, UIToFP, S, Name, InsertAtEnd) {
@@ -4408,12 +3956,6 @@ SIToFPInst::SIToFPInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal SIToFP");
}
-SIToFPInst::SIToFPInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, SIToFP, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal SIToFP");
-}
-
SIToFPInst::SIToFPInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, SIToFP, S, Name, InsertAtEnd) {
@@ -4426,12 +3968,6 @@ FPToUIInst::FPToUIInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPToUI");
}
-FPToUIInst::FPToUIInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, FPToUI, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPToUI");
-}
-
FPToUIInst::FPToUIInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, FPToUI, S, Name, InsertAtEnd) {
@@ -4444,12 +3980,6 @@ FPToSIInst::FPToSIInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPToSI");
}
-FPToSIInst::FPToSIInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, FPToSI, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal FPToSI");
-}
-
FPToSIInst::FPToSIInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, FPToSI, S, Name, InsertAtEnd) {
@@ -4462,12 +3992,6 @@ PtrToIntInst::PtrToIntInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal PtrToInt");
}
-PtrToIntInst::PtrToIntInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, PtrToInt, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal PtrToInt");
-}
-
PtrToIntInst::PtrToIntInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, PtrToInt, S, Name, InsertAtEnd) {
@@ -4480,12 +4004,6 @@ IntToPtrInst::IntToPtrInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal IntToPtr");
}
-IntToPtrInst::IntToPtrInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, IntToPtr, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal IntToPtr");
-}
-
IntToPtrInst::IntToPtrInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, IntToPtr, S, Name, InsertAtEnd) {
@@ -4498,12 +4016,6 @@ BitCastInst::BitCastInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal BitCast");
}
-BitCastInst::BitCastInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, BitCast, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal BitCast");
-}
-
BitCastInst::BitCastInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, BitCast, S, Name, InsertAtEnd) {
@@ -4516,12 +4028,6 @@ AddrSpaceCastInst::AddrSpaceCastInst(Value *S, Type *Ty, const Twine &Name,
assert(castIsValid(getOpcode(), S, Ty) && "Illegal AddrSpaceCast");
}
-AddrSpaceCastInst::AddrSpaceCastInst(
- Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
-) : CastInst(Ty, AddrSpaceCast, S, Name, InsertBefore) {
- assert(castIsValid(getOpcode(), S, Ty) && "Illegal AddrSpaceCast");
-}
-
AddrSpaceCastInst::AddrSpaceCastInst(
Value *S, Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd
) : CastInst(Ty, AddrSpaceCast, S, Name, InsertAtEnd) {
@@ -4546,12 +4052,10 @@ CmpInst::CmpInst(Type *ty, OtherOps op, Predicate predicate, Value *LHS,
}
CmpInst::CmpInst(Type *ty, OtherOps op, Predicate predicate, Value *LHS,
- Value *RHS, const Twine &Name, Instruction *InsertBefore,
+ Value *RHS, const Twine &Name, BasicBlock *InsertAtEnd,
Instruction *FlagsSource)
- : Instruction(ty, op,
- OperandTraits<CmpInst>::op_begin(this),
- OperandTraits<CmpInst>::operands(this),
- InsertBefore) {
+ : Instruction(ty, op, OperandTraits<CmpInst>::op_begin(this),
+ OperandTraits<CmpInst>::operands(this), InsertAtEnd) {
Op<0>() = LHS;
Op<1>() = RHS;
setPredicate((Predicate)predicate);
@@ -4560,18 +4064,6 @@ CmpInst::CmpInst(Type *ty, OtherOps op, Predicate predicate, Value *LHS,
copyIRFlags(FlagsSource);
}
-CmpInst::CmpInst(Type *ty, OtherOps op, Predicate predicate, Value *LHS,
- Value *RHS, const Twine &Name, BasicBlock *InsertAtEnd)
- : Instruction(ty, op,
- OperandTraits<CmpInst>::op_begin(this),
- OperandTraits<CmpInst>::operands(this),
- InsertAtEnd) {
- Op<0>() = LHS;
- Op<1>() = RHS;
- setPredicate((Predicate)predicate);
- setName(Name);
-}
-
CmpInst *
CmpInst::Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
const Twine &Name, BasicBlock::iterator InsertBefore) {
@@ -4584,26 +4076,6 @@ CmpInst::Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
S1, S2, Name);
}
-CmpInst *
-CmpInst::Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
- const Twine &Name, Instruction *InsertBefore) {
- if (Op == Instruction::ICmp) {
- if (InsertBefore)
- return new ICmpInst(InsertBefore, CmpInst::Predicate(predicate),
- S1, S2, Name);
- else
- return new ICmpInst(CmpInst::Predicate(predicate),
- S1, S2, Name);
- }
-
- if (InsertBefore)
- return new FCmpInst(InsertBefore, CmpInst::Predicate(predicate),
- S1, S2, Name);
- else
- return new FCmpInst(CmpInst::Predicate(predicate),
- S1, S2, Name);
-}
-
CmpInst *
CmpInst::Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
const Twine &Name, BasicBlock *InsertAtEnd) {
@@ -5071,17 +4543,6 @@ SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
init(Value, Default, 2 + NumCases * 2);
}
-/// SwitchInst ctor - Create a new switch instruction, specifying a value to
-/// switch on and a default destination. The number of additional cases can
-/// be specified here to make memory allocation more efficient. This
-/// constructor can also autoinsert before another instruction.
-SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(Value->getContext()), Instruction::Switch,
- nullptr, 0, InsertBefore) {
- init(Value, Default, 2+NumCases*2);
-}
-
/// SwitchInst ctor - Create a new switch instruction, specifying a value to
/// switch on and a default destination. The number of additional cases can
/// be specified here to make memory allocation more efficient. This
@@ -5300,13 +4761,6 @@ IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
init(Address, NumCases);
}
-IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
- Instruction *InsertBefore)
- : Instruction(Type::getVoidTy(Address->getContext()),
- Instruction::IndirectBr, nullptr, 0, InsertBefore) {
- init(Address, NumCases);
-}
-
IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(Address->getContext()),
@@ -5363,12 +4817,6 @@ FreezeInst::FreezeInst(Value *S, const Twine &Name,
setName(Name);
}
-FreezeInst::FreezeInst(Value *S,
- const Twine &Name, Instruction *InsertBefore)
- : UnaryInstruction(S->getType(), Freeze, S, InsertBefore) {
- setName(Name);
-}
-
FreezeInst::FreezeInst(Value *S,
const Twine &Name, BasicBlock *InsertAtEnd)
: UnaryInstruction(S->getType(), Freeze, S, InsertAtEnd) {
More information about the llvm-commits
mailing list