[llvm] [IR] Make instr-create fns with Instruction *InsertBefore non-default (PR #86132)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 08:37:41 PDT 2024
https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/86132
>From efaf03b82999084b7494beac2e33843f57c220ee Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 21 Mar 2024 14:55:37 +0000
Subject: [PATCH 1/3] Make instr-create fns with Instruction *InsertBefore
non-default
---
llvm/include/llvm/IR/InstrTypes.h | 205 ++++++----
llvm/include/llvm/IR/Instruction.h | 4 +-
llvm/include/llvm/IR/Instructions.h | 571 ++++++++++++++--------------
llvm/lib/IR/Instructions.cpp | 97 +++++
4 files changed, 523 insertions(+), 354 deletions(-)
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index e8c2cba8418dc8..4d5ccbbbb46f3d 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -60,11 +60,11 @@ class UnaryInstruction : public Instruction {
Op<0>() = V;
}
UnaryInstruction(Type *Ty, unsigned iType, Value *V,
- Instruction *IB = nullptr)
+ Instruction *IB)
: Instruction(Ty, iType, &Op<0>(), 1, IB) {
Op<0>() = V;
}
- UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
+ UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE = nullptr)
: Instruction(Ty, iType, &Op<0>(), 1, IAE) {
Op<0>() = V;
}
@@ -132,16 +132,16 @@ class UnaryOperator : public UnaryInstruction {
/// Instruction is allowed to be a dereferenced end iterator.
///
static UnaryOperator *Create(UnaryOps Op, Value *S,
- const Twine &Name = Twine(),
- Instruction *InsertBefore = nullptr);
+ const Twine &Name,
+ Instruction *InsertBefore);
/// 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
@@ -180,13 +180,22 @@ class UnaryOperator : public UnaryInstruction {
static UnaryOperator *
CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &Name,
+ Instruction *InsertBefore) {
UnaryOperator *UO = Create(Opc, V, Name, InsertBefore);
UO->copyIRFlags(CopyO);
return UO;
}
+ static UnaryOperator *
+ CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO,
+ const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr) {
+ UnaryOperator *UO = Create(Opc, V, Name, InsertAtEnd);
+ UO->copyIRFlags(CopyO);
+ return UO;
+ }
+
static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
const Twine &Name,
BasicBlock::iterator InsertBefore) {
@@ -195,12 +204,19 @@ class UnaryOperator : public UnaryInstruction {
}
static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &Name,
+ Instruction *InsertBefore) {
return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name,
InsertBefore);
}
+ static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
+ const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr) {
+ return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name,
+ InsertAtEnd);
+ }
+
UnaryOps getOpcode() const {
return static_cast<UnaryOps>(Instruction::getOpcode());
}
@@ -256,15 +272,15 @@ class BinaryOperator : public Instruction {
/// 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);
+ const Twine &Name,
+ Instruction *InsertBefore);
/// 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
@@ -304,13 +320,22 @@ class BinaryOperator : public Instruction {
static BinaryOperator *
CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Value *CopyO,
- const Twine &Name = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &Name,
+ Instruction *InsertBefore) {
BinaryOperator *BO = Create(Opc, V1, V2, Name, InsertBefore);
BO->copyIRFlags(CopyO);
return BO;
}
+ static BinaryOperator *
+ CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Value *CopyO,
+ const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr) {
+ BinaryOperator *BO = Create(Opc, V1, V2, Name, InsertAtEnd);
+ BO->copyIRFlags(CopyO);
+ return BO;
+ }
+
static BinaryOperator *CreateFAddFMF(Value *V1, Value *V2,
Instruction *FMFSource,
const Twine &Name = "") {
@@ -472,22 +497,22 @@ class BinaryOperator : public Instruction {
BasicBlock *InsertAtEnd = nullptr);
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);
+ Instruction *InsertBefore);
+ static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
+ 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);
+ Instruction *InsertBefore);
+ static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name = "",
+ 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);
+ Instruction *InsertBefore);
+ static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr);
BinaryOps getOpcode() const {
return static_cast<BinaryOps>(Instruction::getOpcode());
@@ -587,13 +612,13 @@ class CastInst : public UnaryInstruction {
}
/// Constructor with insert-before-instruction semantics for subclasses
CastInst(Type *Ty, unsigned iType, Value *S,
- const Twine &NameStr = "", Instruction *InsertBefore = nullptr)
+ const Twine &NameStr, Instruction *InsertBefore)
: 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)
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr)
: UnaryInstruction(Ty, iType, S, InsertAtEnd) {
setName(NameStr);
}
@@ -622,8 +647,8 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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
@@ -635,8 +660,8 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create a ZExt or BitCast cast instruction
@@ -651,16 +676,16 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create a SExt or BitCast cast instruction
@@ -675,24 +700,24 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The 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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
@@ -707,16 +732,16 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *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 operand is casted
- const Twine &Name, ///< The name for the instruction
- BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create a BitCast or an AddrSpaceCast cast instruction.
@@ -731,8 +756,8 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< Place to insert the instruction
);
/// Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
@@ -748,6 +773,19 @@ class CastInst : public UnaryInstruction {
BasicBlock::iterator InsertBefore ///< 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,
+ /// creates a PtrToInt cast. If the value is an integer type and the
+ /// 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 ///< 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,
@@ -758,7 +796,7 @@ class CastInst : public UnaryInstruction {
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
+ BasicBlock *InsertAtEnd = nullptr ///< Place to insert the instruction
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
@@ -775,8 +813,8 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< Place to insert the instruction
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
@@ -784,8 +822,8 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
@@ -800,16 +838,16 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Create a Trunc or BitCast cast instruction
@@ -824,16 +862,16 @@ class CastInst : public UnaryInstruction {
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
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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
+ const Twine &Name = "", ///< The name for the instruction
+ BasicBlock *InsertAtEnd = nullptr ///< The block to insert the instruction into
);
/// Check whether a bitcast between these types is valid
@@ -1021,13 +1059,13 @@ class CmpInst : public Instruction {
Instruction *FlagsSource = nullptr);
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
- Value *LHS, Value *RHS, const Twine &Name = "",
- Instruction *InsertBefore = nullptr,
+ Value *LHS, Value *RHS, const Twine &Name,
+ Instruction *InsertBefore,
Instruction *FlagsSource = nullptr);
CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
- Value *LHS, Value *RHS, const Twine &Name,
- BasicBlock *InsertAtEnd);
+ Value *LHS, Value *RHS, const Twine &Name = "",
+ BasicBlock *InsertAtEnd = nullptr);
public:
// allocate space for exactly two operands
@@ -1048,15 +1086,15 @@ class CmpInst : public Instruction {
/// Create a CmpInst
static CmpInst *Create(OtherOps Op,
Predicate predicate, Value *S1,
- Value *S2, const Twine &Name = "",
- Instruction *InsertBefore = nullptr);
+ Value *S2, const Twine &Name,
+ Instruction *InsertBefore);
/// 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);
+ Value *S2, const Twine &Name = "", BasicBlock *InsertAtEnd = nullptr);
/// Get the opcode casted to the right type
OtherOps getOpcode() const {
@@ -1513,7 +1551,16 @@ class CallBase : public Instruction {
/// 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);
+ Instruction *InsertPt);
+
+ /// Create a clone of \p CB with a different set of operand bundles and
+ /// insert it at the end of \p InsertAtEnd.
+ ///
+ /// 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,
+ BasicBlock *InsertAtEnd = nullptr);
/// 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.
@@ -1530,12 +1577,26 @@ class CallBase : public Instruction {
/// the specified operand bundle has been replaced.
static CallBase *Create(CallBase *CB,
OperandBundleDef Bundle,
- Instruction *InsertPt = nullptr);
+ Instruction *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 at the end of \p InsertAtEnd.
+ ///
+ /// 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,
+ BasicBlock *InsertAtEnd = nullptr);
/// 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);
+ Instruction *InsertPt);
+
+ /// Create a clone of \p CB with operand bundle \p OB added.
+ static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
+ OperandBundleDef OB,
+ BasicBlock *InsertAtEnd = nullptr);
/// Create a clone of \p CB with operand bundle \p OB added.
static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
@@ -1544,7 +1605,11 @@ 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);
+ Instruction *InsertPt);
+
+ /// Create a clone of \p CB with operand bundle \p ID removed.
+ static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
+ BasicBlock *InsertAtEnd = nullptr);
/// Create a clone of \p CB with operand bundle \p ID removed.
static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 6e0874c5b04f29..08e305a6eb141b 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -1012,9 +1012,9 @@ 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 *InsertBefore);
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..4fe7f3194f1606 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -90,9 +90,9 @@ class AllocaInst : public UnaryInstruction {
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);
+ const Twine &Name, Instruction *InsertBefore);
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.
@@ -212,19 +212,19 @@ class LoadInst : public UnaryInstruction {
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);
+ Align Align, Instruction *InsertBefore);
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);
+ SyncScope::ID SSID,
+ Instruction *InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, AtomicOrdering Order, SyncScope::ID SSID,
- BasicBlock *InsertAtEnd);
+ Align Align, AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
+ BasicBlock *InsertAtEnd = nullptr);
/// Return true if this is a load from a volatile memory location.
bool isVolatile() const { return getSubclassData<VolatileField>(); }
@@ -339,16 +339,16 @@ class StoreInst : public Instruction {
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
BasicBlock::iterator InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- Instruction *InsertBefore = nullptr);
+ Instruction *InsertBefore);
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);
+ AtomicOrdering Order, SyncScope::ID SSID,
+ Instruction *InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd);
+ AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System, BasicBlock *InsertAtEnd = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock::iterator InsertBefore);
@@ -474,10 +474,10 @@ class FenceInst : public Instruction {
FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID,
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);
+ SyncScope::ID SSID,
+ Instruction *InsertBefore);
+ FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID = SyncScope::System,
+ BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, 0); }
@@ -560,11 +560,11 @@ class AtomicCmpXchgInst : public Instruction {
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering, SyncScope::ID SSID,
- Instruction *InsertBefore = nullptr);
+ Instruction *InsertBefore);
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 +824,10 @@ class AtomicRMWInst : public Instruction {
BasicBlock::iterator InsertBefore);
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
AtomicOrdering Ordering, SyncScope::ID SSID,
- Instruction *InsertBefore = nullptr);
+ Instruction *InsertBefore);
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); }
@@ -1012,8 +1012,8 @@ class GetElementPtrInst : public Instruction {
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
unsigned Values = 1 + unsigned(IdxList.size());
assert(PointeeType && "Must specify element type");
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
@@ -1022,8 +1022,8 @@ class GetElementPtrInst : public Instruction {
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + unsigned(IdxList.size());
assert(PointeeType && "Must specify element type");
return new (Values) GetElementPtrInst(PointeeType, Ptr, IdxList, Values,
@@ -1044,8 +1044,8 @@ class GetElementPtrInst : public Instruction {
static GetElementPtrInst *
CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef<Value *> IdxList,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
GetElementPtrInst *GEP =
Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
GEP->setIsInBounds(true);
@@ -1054,8 +1054,8 @@ class GetElementPtrInst : public Instruction {
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);
@@ -1622,8 +1622,8 @@ 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) {
+ static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr,
+ Instruction *InsertBefore) {
return new (ComputeNumOperands(0)) CallInst(Ty, F, NameStr, InsertBefore);
}
@@ -1636,7 +1636,7 @@ class CallInst : public CallBase {
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return new (ComputeNumOperands(Args.size()))
CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore);
}
@@ -1654,9 +1654,9 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
const int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -1665,20 +1665,20 @@ class CallInst : public CallBase {
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) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
const int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -1693,8 +1693,8 @@ class CallInst : public CallBase {
InsertBefore);
}
- static CallInst *Create(FunctionCallee Func, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ static CallInst *Create(FunctionCallee Func, const Twine &NameStr,
+ Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), NameStr,
InsertBefore);
}
@@ -1708,9 +1708,9 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
NameStr, InsertBefore);
}
@@ -1724,26 +1724,26 @@ class CallInst : public CallBase {
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
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) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
NameStr, InsertAtEnd);
}
@@ -1757,7 +1757,9 @@ class CallInst : public CallBase {
static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ Instruction *InsertPt);
+ static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
+ BasicBlock *InsertAtEnd = nullptr);
// Note that 'musttail' implies 'tail'.
enum TailCallKind : unsigned {
@@ -1907,8 +1909,8 @@ class SelectInst : public Instruction {
}
static SelectInst *Create(Value *C, Value *S1, Value *S2,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr,
+ const Twine &NameStr,
+ Instruction *InsertBefore,
Instruction *MDFrom = nullptr) {
SelectInst *Sel = new(3) SelectInst(C, S1, S2, NameStr, InsertBefore);
if (MDFrom)
@@ -1917,8 +1919,8 @@ class SelectInst : public Instruction {
}
static SelectInst *Create(Value *C, Value *S1, Value *S2,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new(3) SelectInst(C, S1, S2, NameStr, InsertAtEnd);
}
@@ -1984,14 +1986,14 @@ class VAArgInst : public UnaryInstruction {
setName(NameStr);
}
- VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr)
+ VAArgInst(Value *List, Type *Ty, const Twine &NameStr,
+ Instruction *InsertBefore)
: UnaryInstruction(Ty, VAArg, List, InsertBefore) {
setName(NameStr);
}
- VAArgInst(Value *List, Type *Ty, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
+ VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr)
: UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
setName(NameStr);
}
@@ -2019,10 +2021,10 @@ class VAArgInst : public UnaryInstruction {
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);
+ Instruction *InsertBefore);
+ ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -2038,14 +2040,14 @@ class ExtractElementInst : public Instruction {
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
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);
}
@@ -2092,10 +2094,10 @@ class InsertElementInst : public Instruction {
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr,
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);
+ const Twine &NameStr,
+ Instruction *InsertBefore);
+ InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -2111,14 +2113,14 @@ class InsertElementInst : public Instruction {
}
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new(3) InsertElementInst(Vec, NewElt, Idx, NameStr, InsertBefore);
}
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new(3) InsertElementInst(Vec, NewElt, Idx, NameStr, InsertAtEnd);
}
@@ -2181,30 +2183,30 @@ class ShuffleVectorInst : public Instruction {
public:
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);
+ Instruction *InsertBefore);
+ ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "",
+ 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);
+ Instruction *InsertBefore);
+ ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr,
- BasicBlock::iterator InsertBefor);
+ BasicBlock::iterator InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr = "",
- Instruction *InsertBefor = nullptr);
+ const Twine &NameStr,
+ Instruction *InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr, BasicBlock::iterator InsertBefor);
+ const Twine &NameStr, BasicBlock::iterator InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr = "",
- Instruction *InsertBefor = nullptr);
+ const Twine &NameStr,
+ Instruction *InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ const Twine &NameStr = "", 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); }
@@ -2706,16 +2708,16 @@ class ExtractValueInst : public UnaryInstruction {
static ExtractValueInst *Create(Value *Agg,
ArrayRef<unsigned> Idxs,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new
ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);
}
static ExtractValueInst *Create(Value *Agg,
ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new ExtractValueInst(Agg, Idxs, NameStr, InsertAtEnd);
}
@@ -2822,10 +2824,10 @@ 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,
+ Instruction *InsertBefore);
+ InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
const Twine &NameStr);
@@ -2849,15 +2851,15 @@ class InsertValueInst : public Instruction {
static InsertValueInst *Create(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertBefore);
}
static InsertValueInst *Create(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertAtEnd);
}
@@ -2977,8 +2979,8 @@ class PHINode : public Instruction {
}
explicit PHINode(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr)
+ const Twine &NameStr,
+ Instruction *InsertBefore)
: Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
ReservedSpace(NumReservedValues) {
assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
@@ -2986,8 +2988,8 @@ class PHINode : public Instruction {
allocHungoffUses(ReservedSpace);
}
- PHINode(Type *Ty, unsigned NumReservedValues, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
+ PHINode(Type *Ty, unsigned 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!");
@@ -3018,13 +3020,13 @@ class PHINode : public Instruction {
}
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
}
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
}
@@ -3270,10 +3272,10 @@ class LandingPadInst : public Instruction {
const Twine &NameStr,
BasicBlock::iterator InsertBefore);
static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr);
+ const Twine &NameStr,
+ Instruction *InsertBefore);
static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
- const Twine &NameStr, BasicBlock *InsertAtEnd);
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -3354,9 +3356,9 @@ class ReturnInst : public Instruction {
// if it was passed NULL.
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);
+ explicit ReturnInst(LLVMContext &C, Value *retVal,
+ Instruction *InsertBefore);
+ ReturnInst(LLVMContext &C, Value *retVal = nullptr, BasicBlock *InsertAtEnd = nullptr);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
protected:
@@ -3371,13 +3373,13 @@ class ReturnInst : public Instruction {
return new (!!retVal) ReturnInst(C, retVal, InsertBefore);
}
- static ReturnInst* Create(LLVMContext &C, Value *retVal = nullptr,
- Instruction *InsertBefore = nullptr) {
+ static ReturnInst* Create(LLVMContext &C, Value *retVal,
+ Instruction *InsertBefore) {
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 +3446,12 @@ 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);
+ explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- Instruction *InsertBefore = nullptr);
- BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd);
+ Instruction *InsertBefore);
+ BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd = nullptr);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
void AssertOK();
@@ -3493,7 +3495,7 @@ class BranchInst : public Instruction {
}
static BranchInst *Create(BasicBlock *IfTrue,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return new(1) BranchInst(IfTrue, InsertBefore);
}
@@ -3503,16 +3505,16 @@ class BranchInst : public Instruction {
}
static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *IfFalse,
- Value *Cond, Instruction *InsertBefore = nullptr) {
+ Value *Cond, Instruction *InsertBefore) {
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);
}
@@ -3789,12 +3791,12 @@ class SwitchInst : public Instruction {
static SwitchInst *Create(Value *Value, BasicBlock *Default,
unsigned NumCases,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return new SwitchInst(Value, Default, NumCases, InsertBefore);
}
static SwitchInst *Create(Value *Value, BasicBlock *Default,
- unsigned NumCases, BasicBlock *InsertAtEnd) {
+ unsigned NumCases, BasicBlock *InsertAtEnd = nullptr) {
return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
}
@@ -4074,12 +4076,12 @@ class IndirectBrInst : public Instruction {
}
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return new IndirectBrInst(Address, NumDests, InsertBefore);
}
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return new IndirectBrInst(Address, NumDests, InsertAtEnd);
}
@@ -4210,7 +4212,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
int NumOperands = ComputeNumOperands(Args.size());
return new (NumOperands)
InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
@@ -4233,9 +4235,9 @@ 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) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4247,7 +4249,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ const Twine &NameStr, BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size());
return new (NumOperands)
InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
@@ -4256,8 +4258,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) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4278,7 +4280,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, std::nullopt, NameStr, InsertBefore);
}
@@ -4294,24 +4296,24 @@ 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) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
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) {
+ const Twine &NameStr, BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, NameStr, InsertAtEnd);
}
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4325,7 +4327,9 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ Instruction *InsertPt);
+ static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
+ BasicBlock *InsertAtEnd = nullptr);
// get*Dest - Return the destination basic blocks...
BasicBlock *getNormalDest() const {
@@ -4477,7 +4481,7 @@ class CallBrInst : public CallBase {
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size());
return new (NumOperands)
CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, std::nullopt,
@@ -4501,8 +4505,8 @@ class CallBrInst : public CallBase {
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) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr, Instruction *InsertBefore) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4516,7 +4520,7 @@ class CallBrInst : public CallBase {
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size());
return new (NumOperands)
CallBrInst(Ty, Func, DefaultDest, IndirectDests, Args, std::nullopt,
@@ -4527,8 +4531,8 @@ class CallBrInst : public CallBase {
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4549,7 +4553,7 @@ class CallBrInst : public CallBase {
static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, const Twine &NameStr,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, NameStr, InsertBefore);
}
@@ -4567,9 +4571,9 @@ 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) {
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, Bundles, NameStr, InsertBefore);
}
@@ -4577,7 +4581,7 @@ class CallBrInst : public CallBase {
static CallBrInst *Create(FunctionCallee Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, NameStr, InsertAtEnd);
}
@@ -4586,8 +4590,8 @@ class CallBrInst : public CallBase {
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr, BasicBlock *InsertAtEnd) {
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4602,7 +4606,10 @@ class CallBrInst : public CallBase {
BasicBlock::iterator InsertPt);
static CallBrInst *Create(CallBrInst *CBI,
ArrayRef<OperandBundleDef> Bundles,
- Instruction *InsertPt = nullptr);
+ Instruction *InsertPt);
+ static CallBrInst *Create(CallBrInst *CBI,
+ ArrayRef<OperandBundleDef> Bundles,
+ BasicBlock *InsertAtEnd = nullptr);
/// Return the number of callbr indirect dest labels.
///
@@ -4729,11 +4736,11 @@ class ResumeInst : public Instruction {
return new (1) ResumeInst(Exn, InsertBefore);
}
- static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = nullptr) {
+ static ResumeInst *Create(Value *Exn, Instruction *InsertBefore) {
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);
}
@@ -4833,15 +4840,15 @@ class CatchSwitchInst : public Instruction {
static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
unsigned NumHandlers,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
InsertBefore);
}
static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers, const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ unsigned NumHandlers, const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
InsertAtEnd);
}
@@ -4994,16 +5001,16 @@ class CleanupPadInst : public FuncletPadInst {
}
static CleanupPadInst *Create(Value *ParentPad,
- ArrayRef<Value *> Args = std::nullopt,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ ArrayRef<Value *> Args,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
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) {
+ static CleanupPadInst *Create(Value *ParentPad, ArrayRef<Value *> Args = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertAtEnd);
@@ -5049,15 +5056,15 @@ class CatchPadInst : public FuncletPadInst {
}
static CatchPadInst *Create(Value *CatchSwitch, ArrayRef<Value *> Args,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
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) {
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
@@ -5109,14 +5116,14 @@ class CatchReturnInst : public Instruction {
}
static CatchReturnInst *Create(Value *CatchPad, BasicBlock *BB,
- Instruction *InsertBefore = nullptr) {
+ Instruction *InsertBefore) {
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);
@@ -5183,9 +5190,9 @@ class CleanupReturnInst : public Instruction {
CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
BasicBlock::iterator InsertBefore);
CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
- Instruction *InsertBefore = nullptr);
+ Instruction *InsertBefore);
CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB, unsigned Values,
- BasicBlock *InsertAtEnd);
+ BasicBlock *InsertAtEnd = nullptr);
void init(Value *CleanupPad, BasicBlock *UnwindBB);
@@ -5207,8 +5214,8 @@ class CleanupReturnInst : public Instruction {
}
static CleanupReturnInst *Create(Value *CleanupPad,
- BasicBlock *UnwindBB = nullptr,
- Instruction *InsertBefore = nullptr) {
+ BasicBlock *UnwindBB,
+ Instruction *InsertBefore) {
assert(CleanupPad);
unsigned Values = 1;
if (UnwindBB)
@@ -5217,8 +5224,8 @@ class CleanupReturnInst : public Instruction {
CleanupReturnInst(CleanupPad, UnwindBB, Values, InsertBefore);
}
- static CleanupReturnInst *Create(Value *CleanupPad, BasicBlock *UnwindBB,
- BasicBlock *InsertAtEnd) {
+ static CleanupReturnInst *Create(Value *CleanupPad, BasicBlock *UnwindBB = nullptr,
+ BasicBlock *InsertAtEnd = nullptr) {
assert(CleanupPad);
unsigned Values = 1;
if (UnwindBB)
@@ -5304,8 +5311,8 @@ 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, Instruction *InsertBefore);
+ 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); }
@@ -5357,16 +5364,16 @@ class TruncInst : public CastInst {
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
+ const Twine &NameStr, ///< A name for the new instruction
+ Instruction *InsertBefore ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5402,18 +5409,18 @@ class ZExtInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5451,16 +5458,16 @@ class SExtInst : public CastInst {
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
+ const Twine &NameStr, ///< A name for the new instruction
+ Instruction *InsertBefore ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5496,18 +5503,18 @@ 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5545,16 +5552,16 @@ class FPExtInst : public CastInst {
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
+ const Twine &NameStr, ///< A name for the new instruction
+ Instruction *InsertBefore ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5592,16 +5599,16 @@ class UIToFPInst : public CastInst {
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
+ const Twine &NameStr, ///< A name for the new instruction
+ Instruction *InsertBefore ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5637,18 +5644,18 @@ class SIToFPInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5684,18 +5691,18 @@ class FPToUIInst : public CastInst {
/// 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
+ 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 ///< 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5731,18 +5738,18 @@ class FPToSIInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5774,18 +5781,18 @@ class IntToPtrInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Clone an identical IntToPtrInst.
@@ -5829,18 +5836,18 @@ class PtrToIntInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
/// Gets the pointer operand.
@@ -5888,18 +5895,18 @@ class BitCastInst : public CastInst {
/// 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
+ 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 ///< 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
+ 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 ///< The block to insert at the end of
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5936,18 +5943,18 @@ class AddrSpaceCastInst : public CastInst {
/// 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
+ 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 ///< 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 ///< The block to insert at the end of
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -6079,9 +6086,9 @@ class FreezeInst : public UnaryInstruction {
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);
+ const Twine &NameStr,
+ Instruction *InsertBefore);
+ 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/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 494d50f89e374c..6338a732181684 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -332,6 +332,20 @@ CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
}
}
+CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
+ BasicBlock *InsertAtEnd) {
+ switch (CB->getOpcode()) {
+ case Instruction::Call:
+ return CallInst::Create(cast<CallInst>(CB), Bundles, InsertAtEnd);
+ case Instruction::Invoke:
+ return InvokeInst::Create(cast<InvokeInst>(CB), Bundles, InsertAtEnd);
+ case Instruction::CallBr:
+ return CallBrInst::Create(cast<CallBrInst>(CB), Bundles, InsertAtEnd);
+ default:
+ llvm_unreachable("Unknown CallBase sub-class!");
+ }
+}
+
CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
Instruction *InsertPt) {
SmallVector<OperandBundleDef, 2> OpDefs;
@@ -344,6 +358,18 @@ CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
return CallBase::Create(CI, OpDefs, InsertPt);
}
+CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
+ BasicBlock *InsertAtEnd) {
+ 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, InsertAtEnd);
+}
+
Function *CallBase::getCaller() { return getParent()->getParent(); }
@@ -637,6 +663,23 @@ CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
return CreateNew ? Create(CB, Bundles, InsertPt) : CB;
}
+CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
+ BasicBlock *InsertAtEnd) {
+ SmallVector<OperandBundleDef, 1> Bundles;
+ bool CreateNew = false;
+
+ for (unsigned I = 0, E = CB->getNumOperandBundles(); I != E; ++I) {
+ auto Bundle = CB->getOperandBundleAt(I);
+ if (Bundle.getTagID() == ID) {
+ CreateNew = true;
+ continue;
+ }
+ Bundles.emplace_back(Bundle);
+ }
+
+ return CreateNew ? Create(CB, Bundles, InsertAtEnd) : CB;
+}
+
bool CallBase::hasReadingOperandBundles() const {
// Implementation note: this is a conservative implementation of operand
// bundle semantics, where *any* non-assume operand bundle (other than
@@ -829,6 +872,20 @@ CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
return NewCI;
}
+CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
+ BasicBlock *InsertAtEnd) {
+ std::vector<Value *> Args(CI->arg_begin(), CI->arg_end());
+
+ auto *NewCI = CallInst::Create(CI->getFunctionType(), CI->getCalledOperand(),
+ Args, OpB, CI->getName(), InsertAtEnd);
+ NewCI->setTailCallKind(CI->getTailCallKind());
+ NewCI->setCallingConv(CI->getCallingConv());
+ NewCI->SubclassOptionalData = CI->SubclassOptionalData;
+ NewCI->setAttributes(CI->getAttributes());
+ NewCI->setDebugLoc(CI->getDebugLoc());
+ return NewCI;
+}
+
// Update profile weight for call instruction by scaling it using the ratio
// of S/T. The meaning of "branch_weights" meta data for call instruction is
// transfered to represent call count.
@@ -966,6 +1023,20 @@ InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
return NewII;
}
+InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
+ BasicBlock *InsertAtEnd) {
+ 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(), InsertAtEnd);
+ NewII->setCallingConv(II->getCallingConv());
+ NewII->SubclassOptionalData = II->SubclassOptionalData;
+ NewII->setAttributes(II->getAttributes());
+ NewII->setDebugLoc(II->getDebugLoc());
+ return NewII;
+}
+
LandingPadInst *InvokeInst::getLandingPadInst() const {
return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI());
}
@@ -1055,6 +1126,21 @@ CallBrInst *CallBrInst::Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> OpB,
return NewCBI;
}
+CallBrInst *CallBrInst::Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> OpB,
+ BasicBlock *InsertAtEnd) {
+ 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(), InsertAtEnd);
+ NewCBI->setCallingConv(CBI->getCallingConv());
+ NewCBI->SubclassOptionalData = CBI->SubclassOptionalData;
+ NewCBI->setAttributes(CBI->getAttributes());
+ NewCBI->setDebugLoc(CBI->getDebugLoc());
+ NewCBI->NumIndirectDests = CBI->NumIndirectDests;
+ return NewCBI;
+}
+
//===----------------------------------------------------------------------===//
// ReturnInst Implementation
//===----------------------------------------------------------------------===//
@@ -3957,6 +4043,17 @@ CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
}
+CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
+ const Twine &Name,
+ BasicBlock *InsertAtEnd) {
+ if (S->getType()->isPointerTy() && Ty->isIntegerTy())
+ return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
+ if (S->getType()->isIntegerTy() && Ty->isPointerTy())
+ return Create(Instruction::IntToPtr, S, Ty, Name, InsertAtEnd);
+
+ return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
+}
+
CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty, bool isSigned,
const Twine &Name,
BasicBlock::iterator InsertBefore) {
>From f55648e8907cc8be6a93081e378eba22f5959236 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 21 Mar 2024 15:37:07 +0000
Subject: [PATCH 2/3] Fix function bodies that assume non-null InsertAtEnd args
---
llvm/lib/IR/Instructions.cpp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 6338a732181684..e8a68a9dc2520b 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -3276,9 +3276,7 @@ UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S,
UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S,
const Twine &Name,
BasicBlock *InsertAtEnd) {
- UnaryOperator *Res = Create(Op, S, Name);
- Res->insertInto(InsertAtEnd, InsertAtEnd->end());
- return Res;
+ return new UnaryOperator(Op, S, S->getType(), Name, InsertAtEnd);
}
void UnaryOperator::AssertOK() {
@@ -3426,9 +3424,9 @@ BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
const Twine &Name,
BasicBlock *InsertAtEnd) {
- BinaryOperator *Res = Create(Op, S1, S2, Name);
- Res->insertInto(InsertAtEnd, InsertAtEnd->end());
- return Res;
+ assert(S1->getType() == S2->getType() &&
+ "Cannot create binary operator with two operands of differing type!");
+ return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertAtEnd);
}
BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
>From a878aac0cb4af35ea9c59975ca0d2d4ced7b9177 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 21 Mar 2024 15:37:23 +0000
Subject: [PATCH 3/3] Clang-format
---
llvm/include/llvm/IR/InstrTypes.h | 257 ++++++++--------
llvm/include/llvm/IR/Instructions.h | 452 ++++++++++++++--------------
llvm/lib/IR/Instructions.cpp | 1 -
3 files changed, 348 insertions(+), 362 deletions(-)
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 4d5ccbbbb46f3d..41cc14d438a832 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -59,13 +59,13 @@ class UnaryInstruction : public Instruction {
: Instruction(Ty, iType, &Op<0>(), 1, IB) {
Op<0>() = V;
}
- UnaryInstruction(Type *Ty, unsigned iType, Value *V,
- Instruction *IB)
- : Instruction(Ty, iType, &Op<0>(), 1, IB) {
+ UnaryInstruction(Type *Ty, unsigned iType, Value *V, Instruction *IB)
+ : Instruction(Ty, iType, &Op<0>(), 1, IB) {
Op<0>() = V;
}
- UnaryInstruction(Type *Ty, unsigned iType, Value *V, BasicBlock *IAE = nullptr)
- : Instruction(Ty, iType, &Op<0>(), 1, IAE) {
+ UnaryInstruction(Type *Ty, unsigned iType, Value *V,
+ BasicBlock *IAE = nullptr)
+ : Instruction(Ty, iType, &Op<0>(), 1, IAE) {
Op<0>() = V;
}
@@ -131,8 +131,7 @@ class UnaryOperator : public UnaryInstruction {
/// 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,
+ static UnaryOperator *Create(UnaryOps Op, Value *S, const Twine &Name,
Instruction *InsertBefore);
/// Construct a unary instruction, given the opcode and an operand.
@@ -178,10 +177,10 @@ class UnaryOperator : public UnaryInstruction {
return UO;
}
- static UnaryOperator *
- CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO,
- const Twine &Name,
- Instruction *InsertBefore) {
+ static UnaryOperator *CreateWithCopiedFlags(UnaryOps Opc, Value *V,
+ Instruction *CopyO,
+ const Twine &Name,
+ Instruction *InsertBefore) {
UnaryOperator *UO = Create(Opc, V, Name, InsertBefore);
UO->copyIRFlags(CopyO);
return UO;
@@ -272,15 +271,15 @@ class BinaryOperator : public Instruction {
/// Instruction is allowed to be a dereferenced end iterator.
///
static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
- const Twine &Name,
- Instruction *InsertBefore);
+ const Twine &Name, Instruction *InsertBefore);
/// 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 = Twine(), BasicBlock *InsertAtEnd = nullptr);
+ 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
@@ -318,10 +317,10 @@ class BinaryOperator : public Instruction {
return BO;
}
- static BinaryOperator *
- CreateWithCopiedFlags(BinaryOps Opc, Value *V1, Value *V2, Value *CopyO,
- const Twine &Name,
- Instruction *InsertBefore) {
+ static BinaryOperator *CreateWithCopiedFlags(BinaryOps Opc, Value *V1,
+ Value *V2, Value *CopyO,
+ const Twine &Name,
+ Instruction *InsertBefore) {
BinaryOperator *BO = Create(Opc, V1, V2, Name, InsertBefore);
BO->copyIRFlags(CopyO);
return BO;
@@ -611,15 +610,15 @@ class CastInst : public UnaryInstruction {
setName(NameStr);
}
/// Constructor with insert-before-instruction semantics for subclasses
- CastInst(Type *Ty, unsigned iType, Value *S,
- const Twine &NameStr, Instruction *InsertBefore)
- : UnaryInstruction(Ty, iType, S, InsertBefore) {
+ CastInst(Type *Ty, unsigned iType, Value *S, const Twine &NameStr,
+ Instruction *InsertBefore)
+ : 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 = nullptr)
- : 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);
}
@@ -643,12 +642,12 @@ class CastInst : public UnaryInstruction {
/// 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 ///< Place to insert the instruction
+ 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 ///< 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
@@ -656,12 +655,13 @@ class CastInst : public UnaryInstruction {
/// 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create a ZExt or BitCast cast instruction
@@ -674,18 +674,19 @@ 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 ///< Place to insert the 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 ///< 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create a SExt or BitCast cast instruction
@@ -698,26 +699,28 @@ 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 ///< Place to insert the 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 ///< 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 = nullptr ///< 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 ///< The 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
@@ -730,18 +733,19 @@ class CastInst : public UnaryInstruction {
/// 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 ///< 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
+ Instruction *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 operand is casted
- const Twine &Name = "", ///< The name for the instruction
- BasicBlock *InsertAtEnd = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create a BitCast or an AddrSpaceCast cast instruction.
@@ -754,10 +758,10 @@ class CastInst : public UnaryInstruction {
/// 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 ///< 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
+ Instruction *InsertBefore ///< Place to insert the instruction
);
/// Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
@@ -780,10 +784,10 @@ 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 ///< 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
+ Instruction *InsertBefore ///< Place to insert the instruction
);
/// Create a BitCast, a PtrToInt, or an IntToPTr cast instruction.
@@ -793,10 +797,10 @@ 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
- BasicBlock *InsertAtEnd = 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
+ BasicBlock *InsertAtEnd = nullptr ///< Place to insert the instruction
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
@@ -810,20 +814,21 @@ 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 ///< 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
+ bool isSigned, ///< Whether to regard S as signed or not
+ const Twine &Name, ///< Name for the instruction
+ Instruction *InsertBefore ///< 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
@@ -835,19 +840,20 @@ 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 ///< Place to insert the instruction
+ 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 ///< 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Create a Trunc or BitCast cast instruction
@@ -860,18 +866,19 @@ 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 ///< Place to insert the 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 ///< 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 = nullptr ///< 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 ///< The block to insert the instruction into
);
/// Check whether a bitcast between these types is valid
@@ -1058,13 +1065,12 @@ 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,
+ CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
+ Value *RHS, const Twine &Name, Instruction *InsertBefore,
Instruction *FlagsSource = nullptr);
- CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
- Value *LHS, Value *RHS, const Twine &Name = "",
+ CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
+ Value *RHS, const Twine &Name = "",
BasicBlock *InsertAtEnd = nullptr);
public:
@@ -1084,17 +1090,16 @@ class CmpInst : public Instruction {
/// 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);
+ static CmpInst *Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
+ const Twine &Name, Instruction *InsertBefore);
/// 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 = nullptr);
+ 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 {
@@ -1575,23 +1580,21 @@ class CallBase : public Instruction {
///
/// 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,
+ static CallBase *Create(CallBase *CB, OperandBundleDef Bundle,
Instruction *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 at the end of \p InsertAtEnd.
+ /// \p Bundle's tag replaced with Bundle, and insert it at the end of \p
+ /// InsertAtEnd.
///
/// 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,
+ static CallBase *Create(CallBase *CB, OperandBundleDef Bundle,
BasicBlock *InsertAtEnd = nullptr);
/// Create a clone of \p CB with operand bundle \p OB added.
static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
- OperandBundleDef OB,
- Instruction *InsertPt);
+ OperandBundleDef OB, Instruction *InsertPt);
/// Create a clone of \p CB with operand bundle \p OB added.
static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 4fe7f3194f1606..58303225d341dd 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -219,11 +219,11 @@ class LoadInst : public UnaryInstruction {
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,
+ Align Align, AtomicOrdering Order, SyncScope::ID SSID,
Instruction *InsertBefore);
LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
+ Align Align, AtomicOrdering Order,
+ SyncScope::ID SSID = SyncScope::System,
BasicBlock *InsertAtEnd = nullptr);
/// Return true if this is a load from a volatile memory location.
@@ -348,7 +348,8 @@ class StoreInst : public Instruction {
AtomicOrdering Order, SyncScope::ID SSID,
Instruction *InsertBefore);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System, BasicBlock *InsertAtEnd = nullptr);
+ AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
+ BasicBlock *InsertAtEnd = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID,
BasicBlock::iterator InsertBefore);
@@ -473,10 +474,10 @@ class FenceInst : public Instruction {
// SequentiallyConsistent.
FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID,
BasicBlock::iterator InsertBefore);
- FenceInst(LLVMContext &C, AtomicOrdering Ordering,
- SyncScope::ID SSID,
+ FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID,
Instruction *InsertBefore);
- FenceInst(LLVMContext &C, AtomicOrdering Ordering, SyncScope::ID SSID = SyncScope::System,
+ FenceInst(LLVMContext &C, AtomicOrdering Ordering,
+ SyncScope::ID SSID = SyncScope::System,
BasicBlock *InsertAtEnd = nullptr);
// allocate space for exactly zero operands
@@ -1042,10 +1043,10 @@ class GetElementPtrInst : public Instruction {
return GEP;
}
- static GetElementPtrInst *
- CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef<Value *> IdxList,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ static GetElementPtrInst *CreateInBounds(Type *PointeeType, Value *Ptr,
+ ArrayRef<Value *> IdxList,
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
GetElementPtrInst *GEP =
Create(PointeeType, Ptr, IdxList, NameStr, InsertBefore);
GEP->setIsInBounds(true);
@@ -1635,8 +1636,7 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return new (ComputeNumOperands(Args.size()))
CallInst(Ty, Func, Args, std::nullopt, NameStr, InsertBefore);
}
@@ -1655,8 +1655,7 @@ class CallInst : public CallBase {
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
const int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -1671,14 +1670,16 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd = nullptr) {
+ 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 = std::nullopt,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
const int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
const unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -1709,8 +1710,7 @@ class CallInst : public CallBase {
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
NameStr, InsertBefore);
}
@@ -1723,8 +1723,7 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, NameStr,
InsertBefore);
}
@@ -1736,14 +1735,16 @@ class CallInst : public CallBase {
}
static CallInst *Create(FunctionCallee Func, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd = nullptr) {
+ 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 = std::nullopt,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), Args, Bundles,
NameStr, InsertAtEnd);
}
@@ -1909,8 +1910,7 @@ class SelectInst : public Instruction {
}
static SelectInst *Create(Value *C, Value *S1, Value *S2,
- const Twine &NameStr,
- Instruction *InsertBefore,
+ const Twine &NameStr, Instruction *InsertBefore,
Instruction *MDFrom = nullptr) {
SelectInst *Sel = new(3) SelectInst(C, S1, S2, NameStr, InsertBefore);
if (MDFrom)
@@ -1987,14 +1987,14 @@ class VAArgInst : public UnaryInstruction {
}
VAArgInst(Value *List, Type *Ty, const Twine &NameStr,
- Instruction *InsertBefore)
- : UnaryInstruction(Ty, VAArg, List, InsertBefore) {
+ Instruction *InsertBefore)
+ : UnaryInstruction(Ty, VAArg, List, InsertBefore) {
setName(NameStr);
}
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
BasicBlock *InsertAtEnd = nullptr)
- : UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
+ : UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
setName(NameStr);
}
@@ -2040,14 +2040,14 @@ class ExtractElementInst : public Instruction {
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr,
+ Instruction *InsertBefore) {
return new(2) ExtractElementInst(Vec, Idx, NameStr, InsertBefore);
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
- const Twine &NameStr = "",
- BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new(2) ExtractElementInst(Vec, Idx, NameStr, InsertAtEnd);
}
@@ -2093,10 +2093,10 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value)
class InsertElementInst : public Instruction {
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
- const Twine &NameStr,
+ InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr,
Instruction *InsertBefore);
- InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr = "",
+ InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
+ const Twine &NameStr = "",
BasicBlock *InsertAtEnd = nullptr);
protected:
@@ -2195,18 +2195,18 @@ class ShuffleVectorInst : public Instruction {
BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr,
+ ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &NameStr,
Instruction *InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &NameStr, BasicBlock::iterator InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr,
- Instruction *InsertBefore);
+ const Twine &NameStr, Instruction *InsertBefore);
ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
+ const Twine &NameStr = "",
+ 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); }
@@ -2706,16 +2706,14 @@ 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) {
return new
ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);
}
- static ExtractValueInst *Create(Value *Agg,
- ArrayRef<unsigned> Idxs,
+ static ExtractValueInst *Create(Value *Agg, ArrayRef<unsigned> Idxs,
const Twine &NameStr = "",
BasicBlock *InsertAtEnd = nullptr) {
return new ExtractValueInst(Agg, Idxs, NameStr, InsertAtEnd);
@@ -2823,11 +2821,10 @@ class InsertValueInst : public Instruction {
/// one and two index insertvalue instructions are so common.
InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
- const Twine &NameStr,
+ InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr,
Instruction *InsertBefore);
- InsertValueInst(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr = "",
- BasicBlock *InsertAtEnd = nullptr);
+ InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
const Twine &NameStr);
@@ -2850,8 +2847,7 @@ class InsertValueInst : public Instruction {
}
static InsertValueInst *Create(Value *Agg, Value *Val,
- ArrayRef<unsigned> Idxs,
- const Twine &NameStr,
+ ArrayRef<unsigned> Idxs, const Twine &NameStr,
Instruction *InsertBefore) {
return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertBefore);
}
@@ -2978,11 +2974,10 @@ class PHINode : public Instruction {
allocHungoffUses(ReservedSpace);
}
- explicit PHINode(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr,
+ explicit PHINode(Type *Ty, unsigned NumReservedValues, const Twine &NameStr,
Instruction *InsertBefore)
- : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
- ReservedSpace(NumReservedValues) {
+ : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
+ ReservedSpace(NumReservedValues) {
assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
setName(NameStr);
allocHungoffUses(ReservedSpace);
@@ -2990,8 +2985,8 @@ class PHINode : public Instruction {
PHINode(Type *Ty, unsigned NumReservedValues, const Twine &NameStr = "",
BasicBlock *InsertAtEnd = nullptr)
- : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
- ReservedSpace(NumReservedValues) {
+ : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
+ ReservedSpace(NumReservedValues) {
assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
setName(NameStr);
allocHungoffUses(ReservedSpace);
@@ -3020,13 +3015,13 @@ class PHINode : public Instruction {
}
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
}
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertAtEnd);
}
@@ -3275,7 +3270,8 @@ class LandingPadInst : public Instruction {
const Twine &NameStr,
Instruction *InsertBefore);
static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr);
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -3356,9 +3352,9 @@ class ReturnInst : public Instruction {
// if it was passed NULL.
explicit ReturnInst(LLVMContext &C, Value *retVal,
BasicBlock::iterator InsertBefore);
- explicit ReturnInst(LLVMContext &C, Value *retVal,
- Instruction *InsertBefore);
- ReturnInst(LLVMContext &C, Value *retVal = nullptr, BasicBlock *InsertAtEnd = nullptr);
+ explicit ReturnInst(LLVMContext &C, Value *retVal, Instruction *InsertBefore);
+ ReturnInst(LLVMContext &C, Value *retVal = nullptr,
+ BasicBlock *InsertAtEnd = nullptr);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
protected:
@@ -3373,12 +3369,12 @@ class ReturnInst : public Instruction {
return new (!!retVal) ReturnInst(C, retVal, InsertBefore);
}
- static ReturnInst* Create(LLVMContext &C, Value *retVal,
+ static ReturnInst *Create(LLVMContext &C, Value *retVal,
Instruction *InsertBefore) {
return new(!!retVal) ReturnInst(C, retVal, InsertBefore);
}
- static ReturnInst* Create(LLVMContext &C, Value *retVal = nullptr,
+ static ReturnInst *Create(LLVMContext &C, Value *retVal = nullptr,
BasicBlock *InsertAtEnd = nullptr) {
return new(!!retVal) ReturnInst(C, retVal, InsertAtEnd);
}
@@ -3494,8 +3490,7 @@ class BranchInst : public Instruction {
return new(1) BranchInst(IfTrue, InsertBefore);
}
- static BranchInst *Create(BasicBlock *IfTrue,
- Instruction *InsertBefore) {
+ static BranchInst *Create(BasicBlock *IfTrue, Instruction *InsertBefore) {
return new(1) BranchInst(IfTrue, InsertBefore);
}
@@ -3509,7 +3504,8 @@ class BranchInst : public Instruction {
return new(3) BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
}
- static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd = nullptr) {
+ static BranchInst *Create(BasicBlock *IfTrue,
+ BasicBlock *InsertAtEnd = nullptr) {
return new(1) BranchInst(IfTrue, InsertAtEnd);
}
@@ -3790,13 +3786,13 @@ class SwitchInst : public Instruction {
}
static SwitchInst *Create(Value *Value, BasicBlock *Default,
- unsigned NumCases,
- Instruction *InsertBefore) {
+ unsigned NumCases, Instruction *InsertBefore) {
return new SwitchInst(Value, Default, NumCases, InsertBefore);
}
static SwitchInst *Create(Value *Value, BasicBlock *Default,
- unsigned NumCases, BasicBlock *InsertAtEnd = nullptr) {
+ unsigned NumCases,
+ BasicBlock *InsertAtEnd = nullptr) {
return new SwitchInst(Value, Default, NumCases, InsertAtEnd);
}
@@ -4211,8 +4207,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
int NumOperands = ComputeNumOperands(Args.size());
return new (NumOperands)
InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
@@ -4236,8 +4231,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4249,7 +4243,8 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr, BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr,
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size());
return new (NumOperands)
InvokeInst(Ty, Func, IfNormal, IfException, Args, std::nullopt,
@@ -4259,7 +4254,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 = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
int NumOperands =
ComputeNumOperands(Args.size(), CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4279,8 +4275,7 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, std::nullopt, NameStr, InsertBefore);
}
@@ -4297,15 +4292,15 @@ class InvokeInst : public CallBase {
static InvokeInst *Create(FunctionCallee Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
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 = nullptr) {
+ const Twine &NameStr,
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, NameStr, InsertAtEnd);
}
@@ -4313,7 +4308,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 = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), IfNormal,
IfException, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4502,11 +4498,12 @@ 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,
- const Twine &NameStr, Instruction *InsertBefore) {
+ static CallBrInst *Create(FunctionType *Ty, Value *Func,
+ BasicBlock *DefaultDest,
+ ArrayRef<BasicBlock *> IndirectDests,
+ ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr, Instruction *InsertBefore) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4527,12 +4524,11 @@ class CallBrInst : public CallBase {
NumOperands, NameStr, InsertAtEnd);
}
- static CallBrInst *Create(FunctionType *Ty, Value *Func,
- BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests,
- ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles = std::nullopt,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ static CallBrInst *
+ Create(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest,
+ ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles = std::nullopt,
+ const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
int NumOperands = ComputeNumOperands(Args.size(), IndirectDests.size(),
CountBundleInputs(Bundles));
unsigned DescriptorBytes = Bundles.size() * sizeof(BundleOpInfo);
@@ -4572,8 +4568,7 @@ class CallBrInst : public CallBase {
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, Bundles, NameStr, InsertBefore);
}
@@ -4586,12 +4581,12 @@ class CallBrInst : public CallBase {
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 = std::nullopt,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
return Create(Func.getFunctionType(), Func.getCallee(), DefaultDest,
IndirectDests, Args, Bundles, NameStr, InsertAtEnd);
}
@@ -4604,11 +4599,9 @@ class CallBrInst : public CallBase {
/// operand bundles in \p Bundles.
static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
BasicBlock::iterator InsertPt);
- static CallBrInst *Create(CallBrInst *CBI,
- ArrayRef<OperandBundleDef> Bundles,
+ static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
Instruction *InsertPt);
- static CallBrInst *Create(CallBrInst *CBI,
- ArrayRef<OperandBundleDef> Bundles,
+ static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
BasicBlock *InsertAtEnd = nullptr);
/// Return the number of callbr indirect dest labels.
@@ -4839,15 +4832,15 @@ class CatchSwitchInst : public Instruction {
}
static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers,
- const Twine &NameStr,
+ unsigned NumHandlers, const Twine &NameStr,
Instruction *InsertBefore) {
return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
InsertBefore);
}
static CatchSwitchInst *Create(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers, const Twine &NameStr = "",
+ unsigned NumHandlers,
+ const Twine &NameStr = "",
BasicBlock *InsertAtEnd = nullptr) {
return new CatchSwitchInst(ParentPad, UnwindDest, NumHandlers, NameStr,
InsertAtEnd);
@@ -5000,8 +4993,7 @@ class CleanupPadInst : public FuncletPadInst {
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertBefore);
}
- static CleanupPadInst *Create(Value *ParentPad,
- ArrayRef<Value *> Args,
+ static CleanupPadInst *Create(Value *ParentPad, ArrayRef<Value *> Args,
const Twine &NameStr,
Instruction *InsertBefore) {
unsigned Values = 1 + Args.size();
@@ -5009,8 +5001,10 @@ class CleanupPadInst : public FuncletPadInst {
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertBefore);
}
- static CleanupPadInst *Create(Value *ParentPad, ArrayRef<Value *> Args = std::nullopt,
- const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr) {
+ static CleanupPadInst *Create(Value *ParentPad,
+ ArrayRef<Value *> Args = std::nullopt,
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CleanupPadInst(ParentPad, Args, Values, NameStr, InsertAtEnd);
@@ -5056,15 +5050,15 @@ class CatchPadInst : public FuncletPadInst {
}
static CatchPadInst *Create(Value *CatchSwitch, ArrayRef<Value *> Args,
- const Twine &NameStr,
- Instruction *InsertBefore) {
+ const Twine &NameStr, Instruction *InsertBefore) {
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 = nullptr) {
+ const Twine &NameStr = "",
+ BasicBlock *InsertAtEnd = nullptr) {
unsigned Values = 1 + Args.size();
return new (Values)
CatchPadInst(CatchSwitch, Args, Values, NameStr, InsertAtEnd);
@@ -5213,8 +5207,7 @@ class CleanupReturnInst : public Instruction {
CleanupReturnInst(CleanupPad, UnwindBB, Values, InsertBefore);
}
- static CleanupReturnInst *Create(Value *CleanupPad,
- BasicBlock *UnwindBB,
+ static CleanupReturnInst *Create(Value *CleanupPad, BasicBlock *UnwindBB,
Instruction *InsertBefore) {
assert(CleanupPad);
unsigned Values = 1;
@@ -5224,7 +5217,8 @@ class CleanupReturnInst : public Instruction {
CleanupReturnInst(CleanupPad, UnwindBB, Values, InsertBefore);
}
- static CleanupReturnInst *Create(Value *CleanupPad, BasicBlock *UnwindBB = nullptr,
+ static CleanupReturnInst *Create(Value *CleanupPad,
+ BasicBlock *UnwindBB = nullptr,
BasicBlock *InsertAtEnd = nullptr) {
assert(CleanupPad);
unsigned Values = 1;
@@ -5361,19 +5355,18 @@ class TruncInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5408,19 +5401,18 @@ class ZExtInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5455,19 +5447,18 @@ class SExtInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5502,19 +5493,18 @@ 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5549,19 +5539,18 @@ class FPExtInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5596,19 +5585,18 @@ class UIToFPInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5643,19 +5631,18 @@ class SIToFPInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5690,19 +5677,18 @@ class FPToUIInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5737,19 +5723,18 @@ class FPToSIInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5781,18 +5766,18 @@ class IntToPtrInst : public CastInst {
/// 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 ///< 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
+ Instruction *InsertBefore ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Clone an identical IntToPtrInst.
@@ -5836,18 +5821,18 @@ class PtrToIntInst : public CastInst {
/// 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 ///< 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
+ Instruction *InsertBefore ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
/// Gets the pointer operand.
@@ -5894,19 +5879,18 @@ class BitCastInst : public CastInst {
);
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -5943,18 +5927,18 @@ class AddrSpaceCastInst : public CastInst {
/// 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 ///< Where to insert the new instruction
+ 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 ///< 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 = nullptr ///< The block to insert at the end of
+ 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 ///< The block to insert at the end of
);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -6085,10 +6069,10 @@ class FreezeInst : public UnaryInstruction {
public:
explicit FreezeInst(Value *S, const Twine &NameStr,
BasicBlock::iterator InsertBefore);
- explicit FreezeInst(Value *S,
- const Twine &NameStr,
+ explicit FreezeInst(Value *S, const Twine &NameStr,
Instruction *InsertBefore);
- FreezeInst(Value *S, const Twine &NameStr = "", BasicBlock *InsertAtEnd = nullptr);
+ 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/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index e8a68a9dc2520b..4190df1a8fa36d 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -370,7 +370,6 @@ CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
return CallBase::Create(CI, OpDefs, InsertAtEnd);
}
-
Function *CallBase::getCaller() { return getParent()->getParent(); }
unsigned CallBase::getNumSubclassExtraOperandsDynamic() const {
More information about the llvm-commits
mailing list