73#define DEBUG_TYPE "consthoist"
75STATISTIC(NumConstantsHoisted,
"Number of constants hoisted");
76STATISTIC(NumConstantsRebased,
"Number of constants rebased");
91 StringRef getPassName()
const override {
return "Constant Hoisting"; }
93 void getAnalysisUsage(AnalysisUsage &AU)
const override {
95 if (ScalarOptions::Global.consthoist_with_block_frequency)
103 ConstantHoistingPass Impl;
108char ConstantHoistingLegacyPass::ID = 0;
111 "Constant Hoisting",
false,
false)
120 return new ConstantHoistingLegacyPass();
124bool ConstantHoistingLegacyPass::runOnFunction(
Function &Fn) {
125 if (skipFunction(Fn))
128 LLVM_DEBUG(
dbgs() <<
"********** Begin Constant Hoisting **********\n");
132 Impl.runImpl(Fn, getAnalysis<TargetTransformInfoWrapperPass>().getTTI(Fn),
133 getAnalysis<DominatorTreeWrapperPass>().
getDomTree(),
134 ScalarOptions::Global.consthoist_with_block_frequency
135 ? &getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI()
138 &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI());
140 LLVM_DEBUG(
dbgs() <<
"********** End Constant Hoisting **********\n");
145void ConstantHoistingPass::collectMatInsertPts(
147 SmallVectorImpl<BasicBlock::iterator> &MatInsertPts)
const {
148 for (
const RebasedConstantInfo &RCI : RebasedConstants)
149 for (
const ConstantUser &U : RCI.Uses)
155 unsigned Idx)
const {
161 if (CastInst->isCast())
162 return CastInst->getIterator();
171 assert(Entry != Inst->
getParent() &&
"PHI or landing pad in entry block!");
175 if (!InsertionBlock->
isEHPad()) {
185 auto *IDom = DT->getNode(InsertionBlock)->getIDom();
186 while (IDom->getBlock()->isEHPad()) {
187 assert(Entry != IDom->getBlock() &&
"eh pad in entry block");
188 IDom = IDom->getIDom();
191 return IDom->getBlock()->getTerminator()->getIterator();
200 assert(!BBs.
count(Entry) &&
"Assume Entry is not in BBs");
207 for (
auto *BB : BBs) {
224 "Entry doens't dominate current Node");
242 while (Idx != Orders.
size()) {
245 if (Candidates.
count(ChildDomNode->getBlock()))
246 Orders.
push_back(ChildDomNode->getBlock());
251 using InsertPtsCostPair =
262 auto &[InsertPts, InsertPtsFreq] = InsertPtsMap.
find(
Node)->second;
278 auto &[ParentInsertPts, ParentPtsFreq] = InsertPtsMap.
find(Parent)->second;
289 ParentInsertPts.insert(
Node);
292 ParentInsertPts.insert_range(InsertPts);
293 ParentPtsFreq += InsertPtsFreq;
299SetVector<BasicBlock::iterator>
300ConstantHoistingPass::findConstantInsertionPoint(
301 const ConstantInfo &ConstInfo,
305 SetVector<BasicBlock *> BBs;
306 SetVector<BasicBlock::iterator> InsertPts;
309 BBs.
insert(MatInsertPt->getParent());
311 if (BBs.
count(Entry)) {
318 for (BasicBlock *BB : BBs)
319 InsertPts.
insert(BB->getFirstInsertionPt());
323 while (BBs.size() >= 2) {
325 BB1 = BBs.pop_back_val();
326 BB2 = BBs.pop_back_val();
327 BB = DT->findNearestCommonDominator(BB1, BB2);
334 assert((BBs.size() == 1) &&
"Expected only one element.");
336 InsertPts.
insert(findMatInsertPt(&FirstInst));
346void ConstantHoistingPass::collectConstantCandidates(
347 ConstCandMapType &ConstCandMap, Instruction *Inst,
unsigned Idx,
348 ConstantInt *ConstInt) {
366 ConstCandMapType::iterator Itr;
368 ConstPtrUnionType Cand = ConstInt;
369 std::tie(Itr, Inserted) = ConstCandMap.try_emplace(Cand);
371 ConstIntCandVec.push_back(ConstantCandidate(ConstInt));
372 Itr->second = ConstIntCandVec.size() - 1;
374 ConstIntCandVec[Itr->second].addUser(Inst, Idx,
Cost.
getValue());
376 <<
"Collect constant " << *ConstInt <<
" from " << *Inst
377 <<
" with cost " <<
Cost <<
'\n';
378 else dbgs() <<
"Collect constant " << *ConstInt
379 <<
" indirectly from " << *Inst <<
" via "
386void ConstantHoistingPass::collectConstantCandidates(
387 ConstCandMapType &ConstCandMap, Instruction *Inst,
unsigned Idx,
388 ConstantExpr *ConstExpr) {
399 IntegerType *OffsetTy =
DL->getIndexType(*Ctx, GVPtrTy->getAddressSpace());
400 APInt
Offset(
DL->getTypeSizeInBits(OffsetTy), 0,
true);
407 if (!GEPO->isInBounds())
410 if (!GEPO->accumulateConstantOffset(*
DL,
Offset))
423 ConstCandVecType &ExprCandVec = ConstGEPCandMap[BaseGV];
424 ConstCandMapType::iterator Itr;
426 ConstPtrUnionType Cand = ConstExpr;
427 std::tie(Itr, Inserted) = ConstCandMap.try_emplace(Cand);
429 ExprCandVec.push_back(ConstantCandidate(
430 ConstantInt::get(Type::getInt32Ty(*Ctx),
Offset.getLimitedValue()),
432 Itr->second = ExprCandVec.size() - 1;
434 ExprCandVec[Itr->second].addUser(Inst, Idx,
Cost.
getValue());
438void ConstantHoistingPass::collectConstantCandidates(
439 ConstCandMapType &ConstCandMap, Instruction *Inst,
unsigned Idx) {
444 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
452 if (!CastInst->isCast())
458 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
467 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstExpr);
476 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
484void ConstantHoistingPass::collectConstantCandidates(
485 ConstCandMapType &ConstCandMap, Instruction *Inst) {
495 if (!DT->isReachableFromEntry(IncomingBB))
504 collectConstantCandidates(ConstCandMap, Inst, Idx);
511void ConstantHoistingPass::collectConstantCandidates(
Function &Fn) {
512 ConstCandMapType ConstCandMap;
513 for (BasicBlock &BB : Fn) {
515 if (!DT->isReachableFromEntry(&BB))
517 for (Instruction &Inst : BB)
519 collectConstantCandidates(ConstCandMap, &Inst);
547ConstantHoistingPass::maximizeConstantsInRange(ConstCandVecType::iterator S,
548 ConstCandVecType::iterator
E,
549 ConstCandVecType::iterator &MaxCostItr) {
550 unsigned NumUses = 0;
552 if (!OptForSize || std::distance(S,
E) > 100) {
553 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
554 NumUses += ConstCand->Uses.size();
555 if (ConstCand->CumulativeCost > MaxCostItr->CumulativeCost)
556 MaxCostItr = ConstCand;
563 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
564 auto Value = ConstCand->ConstInt->getValue();
565 Type *Ty = ConstCand->ConstInt->getType();
567 NumUses += ConstCand->Uses.size();
568 LLVM_DEBUG(
dbgs() <<
"= Constant: " << ConstCand->ConstInt->getValue()
571 for (
auto User : ConstCand->Uses) {
572 unsigned Opcode =
User.Inst->getOpcode();
573 unsigned OpndIdx =
User.OpndIdx;
578 for (
auto C2 = S; C2 !=
E; ++C2) {
579 APInt Diff = C2->ConstInt->getValue() - ConstCand->ConstInt->getValue();
584 <<
"has penalty: " << ImmCosts <<
"\n"
585 <<
"Adjusted cost: " <<
Cost <<
"\n");
589 if (
Cost > MaxCost) {
591 MaxCostItr = ConstCand;
592 LLVM_DEBUG(
dbgs() <<
"New candidate: " << MaxCostItr->ConstInt->getValue()
601void ConstantHoistingPass::findAndMakeBaseConstant(
602 ConstCandVecType::iterator S, ConstCandVecType::iterator
E,
603 SmallVectorImpl<consthoist::ConstantInfo> &ConstInfoVec) {
605 unsigned NumUses = maximizeConstantsInRange(S,
E, MaxCostItr);
611 ConstantInt *ConstInt = MaxCostItr->ConstInt;
612 ConstantExpr *ConstExpr = MaxCostItr->ConstExpr;
613 ConstantInfo ConstInfo;
619 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
620 APInt Diff = ConstCand->ConstInt->getValue() - ConstInt->
getValue();
621 Constant *
Offset = Diff == 0 ? nullptr : ConstantInt::get(Ty, Diff);
623 ConstCand->ConstExpr ? ConstCand->ConstExpr->getType() :
nullptr;
625 RebasedConstantInfo(std::move(ConstCand->Uses),
Offset, ConstTy));
627 ConstInfoVec.
push_back(std::move(ConstInfo));
632void ConstantHoistingPass::findBaseConstants(GlobalVariable *BaseGV) {
635 ConstCandVecType &ConstCandVec = BaseGV ?
636 ConstGEPCandMap[BaseGV] : ConstIntCandVec;
637 ConstInfoVecType &ConstInfoVec = BaseGV ?
638 ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
642 const ConstantCandidate &
RHS) {
644 return LHS.ConstInt->getBitWidth() <
RHS.ConstInt->getBitWidth();
645 return LHS.ConstInt->getValue().ult(
RHS.ConstInt->getValue());
650 auto MinValItr = ConstCandVec.begin();
651 for (
auto CC = std::next(ConstCandVec.begin()),
E = ConstCandVec.end();
653 if (MinValItr->ConstInt->getType() == CC->ConstInt->getType()) {
654 Type *MemUseValTy =
nullptr;
655 for (
auto &U : CC->Uses) {
658 MemUseValTy = LI->getType();
662 if (
SI->getPointerOperand() ==
SI->getOperand(
U.OpndIdx)) {
663 MemUseValTy =
SI->getValueOperand()->getType();
670 APInt Diff = CC->ConstInt->getValue() - MinValItr->ConstInt->getValue();
682 findAndMakeBaseConstant(MinValItr, CC, ConstInfoVec);
687 findAndMakeBaseConstant(MinValItr, ConstCandVec.end(), ConstInfoVec);
705 for (
unsigned i = 0; i < Idx; ++i) {
706 if (
PHI->getIncomingBlock(i) == IncomingBB) {
707 Value *IncomingVal =
PHI->getIncomingValue(i);
720void ConstantHoistingPass::emitBaseConstants(Instruction *
Base,
721 UserAdjustment *Adj) {
725 if (!Adj->Offset && Adj->Ty && Adj->Ty !=
Base->getType())
726 Adj->Offset = ConstantInt::get(Type::getInt32Ty(*Ctx), 0);
732 "mat_gep", Adj->MatInsertPt);
734 Mat =
new BitCastInst(Mat, Adj->Ty,
"mat_bitcast",
735 Adj->MatInsertPt->getIterator());
740 "const_mat", Adj->MatInsertPt->getIterator());
743 <<
" + " << *Adj->Offset <<
") in BB "
748 Value *Opnd = Adj->User.Inst->getOperand(Adj->User.OpndIdx);
753 if (!
updateOperand(Adj->User.Inst, Adj->User.OpndIdx, Mat) && Adj->Offset)
761 assert(CastInst->isCast() &&
"Expected an cast instruction!");
764 Instruction *&ClonedCastInst = ClonedCastMap[CastInst];
765 if (!ClonedCastInst) {
766 ClonedCastInst = CastInst->
clone();
768 ClonedCastInst->
insertAfter(CastInst->getIterator());
770 ClonedCastInst->
setDebugLoc(CastInst->getDebugLoc());
772 <<
"To : " << *ClonedCastInst <<
'\n');
776 updateOperand(Adj->User.Inst, Adj->User.OpndIdx, ClonedCastInst);
790 assert(ConstExpr->
isCast() &&
"ConstExpr should be a cast");
796 ConstExprInst->
setDebugLoc(Adj->User.Inst->getDebugLoc());
798 LLVM_DEBUG(
dbgs() <<
"Create instruction: " << *ConstExprInst <<
'\n'
799 <<
"From : " << *ConstExpr <<
'\n');
801 if (!
updateOperand(Adj->User.Inst, Adj->User.OpndIdx, ConstExprInst)) {
813bool ConstantHoistingPass::emitBaseConstants(GlobalVariable *BaseGV) {
814 bool MadeChange =
false;
815 SmallVectorImpl<consthoist::ConstantInfo> &ConstInfoVec =
816 BaseGV ? ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
817 for (
const consthoist::ConstantInfo &ConstInfo : ConstInfoVec) {
820 SetVector<BasicBlock::iterator> IPSet =
821 findConstantInsertionPoint(ConstInfo, MatInsertPts);
826 unsigned UsesNum = 0;
827 unsigned ReBasesNum = 0;
828 unsigned NotRebasedNum = 0;
835 UsesNum += RCI.Uses.size();
836 for (
auto const &U : RCI.Uses) {
838 BasicBlock *OrigMatInsertBB = MatInsertPt->getParent();
841 if (IPSet.size() == 1 ||
842 DT->dominates(IP->getParent(), OrigMatInsertBB))
843 ToBeRebased.
emplace_back(RCI.Offset, RCI.Ty, MatInsertPt, U);
849 if (ToBeRebased.
size() <
850 ScalarOptions::Global.consthoist_min_num_to_rebase) {
851 NotRebasedNum += ToBeRebased.
size();
859 assert(BaseGV &&
"A base constant expression must have an base GV");
861 Base =
new BitCastInst(ConstInfo.
BaseExpr, Ty,
"const", IP);
864 Base =
new BitCastInst(ConstInfo.
BaseInt, Ty,
"const", IP);
867 Base->setDebugLoc(IP->getDebugLoc());
870 <<
") to BB " << IP->getParent()->
getName() <<
'\n'
874 for (UserAdjustment &R : ToBeRebased) {
875 emitBaseConstants(
Base, &R);
879 Base->getDebugLoc(),
R.User.Inst->getDebugLoc()));
881 assert(!
Base->use_empty() &&
"The use list is empty!?");
883 "All uses should be instructions.");
889 assert(UsesNum == (ReBasesNum + NotRebasedNum) &&
890 "Not all uses are rebased");
892 NumConstantsHoisted++;
905void ConstantHoistingPass::deleteDeadCastInst()
const {
906 for (
auto const &
I : ClonedCastMap)
907 if (
I.first->use_empty())
908 I.first->eraseFromParent();
920 this->Entry = &Entry;
926 collectConstantCandidates(Fn);
930 if (!ConstIntCandVec.empty())
931 findBaseConstants(
nullptr);
932 for (
const auto &MapEntry : ConstGEPCandMap)
933 if (!MapEntry.second.empty())
934 findBaseConstants(MapEntry.first);
938 bool MadeChange =
false;
939 if (!ConstIntInfoVec.empty())
940 MadeChange = emitBaseConstants(
nullptr);
941 for (
const auto &MapEntry : ConstGEPInfoMap)
942 if (!MapEntry.second.empty())
943 MadeChange |= emitBaseConstants(MapEntry.first);
947 deleteDeadCastInst();
958 auto BFI = ScalarOptions::Global.consthoist_with_block_frequency
963 if (!
runImpl(
F, TTI, DT, BFI,
F.getEntryBlock(), PSI))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void cleanup(BlockFrequencyInfoImplBase &BFI)
Clear all memory not needed downstream.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool runImpl(MachineFunction &MF)
static bool updateOperand(Instruction *Inst, unsigned Idx, Instruction *Mat)
Updates the operand at Idx in instruction Inst with the result of instruction Mat.
static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI, BasicBlock *Entry, SetVector< BasicBlock * > &BBs)
Given BBs as input, find another set of BBs which collectively dominates BBs and have the minimal sum...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
static bool runOnFunction(Function &F, bool PostInlining)
static bool isCandidate(const MachineInstr *MI, Register &DefedReg, Register FrameReg)
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static DominatorTree getDomTree(Function &F)
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
unsigned getBitWidth() const
Return the number of bits in the APInt.
int64_t getSExtValue() const
Get sign extended value.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
AnalysisUsage & addRequired()
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
bool isEHPad() const
Return true if this basic block is an exception handling block.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
static LLVM_ABI BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), InsertPosition InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
Analysis pass which computes BlockFrequencyInfo.
Legacy analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
LLVM_ABI BlockFrequency getBlockFreq(const BasicBlock *BB) const
getblockFreq - Return block frequency.
Represents analyses that only rely on functions' control flow.
LLVM_ABI bool isCast() const
Return true if this is a convert constant expression.
LLVM_ABI Instruction * getAsInstruction() const
Returns an Instruction which implements the same operation as this ConstantExpr.
LLVM_ABI bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)
Optimize expensive integer constants in the given function.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
IntegerType * getIntegerType() const
Variant of the getType() method to always return an IntegerType, which reduces the amount of casting ...
const APInt & getValue() const
Return the constant as an APInt value reference.
static LLVM_ABI DebugLoc getMergedLocation(DebugLoc LocA, DebugLoc LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
iterator_range< iterator > children()
DomTreeNodeBase * getIDom() const
Analysis pass which computes a DominatorTree.
DomTreeNodeBase< NodeT > * getNode(const NodeT *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
Legacy analysis pass which computes a DominatorTree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
LLVM_ABI bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
FunctionPass class - This class is used to implement most global optimizations.
const BasicBlock & getEntryBlock() const
const DataLayout & getDataLayout() const
Get the data layout of the module this function belongs to.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value * > IdxList, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
PointerType * getType() const
Global values are always pointers.
CostType getValue() const
This function is intended to be used as sparingly as possible, since the class provides the full rang...
LLVM_ABI Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following:
LLVM_ABI void insertBefore(InstListType::iterator InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified position.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
LLVM_ABI void insertAfter(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately after the specified instruction.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Analysis providing profile information.
A vector that has set insertion semantics.
void insert_range(Range &&R)
size_type count(const_arg_type key) const
Count the number of elements of a given key in the SetVector.
void clear()
Completely clear the SetVector.
bool empty() const
Determine if the SetVector is empty or not.
bool insert(const value_type &X)
Insert a new element into the SetVector.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
void insert_range(Range &&R)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Analysis pass providing the TargetTransformInfo.
bool isVectorTy() const
True if this is an instance of VectorType.
void setOperand(unsigned i, Value *Val)
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
const ParentTy * getParent() const
self_iterator getIterator()
@ BasicBlock
Various leaf nodes.
A private "module" namespace for types and utilities used by ConstantHoisting.
SmallVector< RebasedConstantInfo, 4 > RebasedConstantListType
@ User
could "use" a pointer
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
LLVM_ABI FunctionPass * createConstantHoistingPass()
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
auto reverse(ContainerTy &&C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI void initializeConstantHoistingLegacyPassPass(PassRegistry &)
LLVM_ABI bool canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx)
Given an instruction, is it legal to set operand OpIdx to a non-constant value?
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
RebasedConstantListType RebasedConstants