22 return isa<ConstantExpr>(U) || isa<ConstantAggregate>(U);
28 if (
auto *CE = dyn_cast<ConstantExpr>(
C)) {
29 NewInsts.
push_back(CE->getAsInstruction(InsertPt));
30 }
else if (isa<ConstantStruct>(
C) || isa<ConstantArray>(
C)) {
36 }
else if (isa<ConstantVector>(
C)) {
54 for (
User *U :
C->users())
56 Stack.push_back(cast<Constant>(U));
60 while (!Stack.empty()) {
65 for (
auto *Nested :
C->users())
67 Stack.push_back(cast<Constant>(Nested));
73 for (
User *U :
C->users())
74 if (
auto *
I = dyn_cast<Instruction>(U))
82 for (
Use &U :
I->operands()) {
84 if (
auto *Phi = dyn_cast<PHINode>(
I)) {
87 assert(It != BB->
end() &&
"Unexpected empty basic block");
91 if (
auto *
C = dyn_cast<Constant>(U.get())) {
95 for (
auto *NI : NewInsts)
98 U.set(NewInsts.back());
105 C->removeDeadConstantUsers();
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
InstListType::iterator iterator
Instruction iterators...
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
static InsertElementInst * Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static InsertValueInst * Create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
InstructionWorklist - This is the worklist management logic for InstCombine and other simplification ...
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A vector that has set insertion semantics.
bool insert(const value_type &X)
Insert a new element into the SetVector.
bool contains(const key_type &key) const
Check if the SetVector contains the given key.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt32Ty(LLVMContext &C)
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
bool convertUsersOfConstantsToInstructions(ArrayRef< Constant * > Consts)
Replace constant expressions users of the given constants with instructions.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are are tuples (A,...
static bool isExpandableUser(User *U)
static SmallVector< Instruction *, 4 > expandUser(Instruction *InsertPt, Constant *C)