76 #define DEBUG_TYPE "consthoist" 78 STATISTIC(NumConstantsHoisted,
"Number of constants hoisted");
79 STATISTIC(NumConstantsRebased,
"Number of constants rebased");
83 cl::desc(
"Enable the use of the block frequency analysis to reduce the " 84 "chance to execute const materialization more frequently than " 85 "without hoisting."));
89 cl::desc(
"Try hoisting constant gep expressions"));
93 cl::desc(
"Do not rebase if number of dependent constants of a Base is less " 100 class ConstantHoistingLegacyPass :
public FunctionPass {
110 StringRef getPassName()
const override {
return "Constant Hoisting"; }
130 "Constant Hoisting",
false,
false)
139 return new ConstantHoistingLegacyPass();
144 if (skipFunction(Fn))
147 LLVM_DEBUG(
dbgs() <<
"********** Begin Constant Hoisting **********\n");
151 Impl.runImpl(Fn, getAnalysis<TargetTransformInfoWrapperPass>().getTTI(Fn),
152 getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
154 ? &getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI()
157 &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI());
160 LLVM_DEBUG(
dbgs() <<
"********** Function after Constant Hoisting: " 164 LLVM_DEBUG(
dbgs() <<
"********** End Constant Hoisting **********\n");
171 unsigned Idx)
const {
176 if (
auto CastInst = dyn_cast<Instruction>(Opnd))
182 if (!isa<PHINode>(Inst) && !Inst->
isEHPad())
188 if (Idx != ~0U && isa<PHINode>(Inst))
189 return cast<PHINode>(Inst)->getIncomingBlock(Idx)->getTerminator();
194 auto IDom = DT->getNode(Inst->
getParent())->getIDom();
195 while (IDom->getBlock()->isEHPad()) {
196 assert(
Entry != IDom->getBlock() &&
"eh pad in entry block");
197 IDom = IDom->getIDom();
200 return IDom->getBlock()->getTerminator();
209 assert(!BBs.
count(Entry) &&
"Assume Entry is not in BBs");
216 for (
auto BB : BBs) {
225 bool isCandidate =
false;
228 if (Node == Entry || Candidates.
count(Node)) {
233 "Entry doens't dominate current Node");
235 }
while (!BBs.count(Node));
243 Candidates.
insert(Path.begin(), Path.end());
251 while (Idx != Orders.
size()) {
254 if (Candidates.
count(ChildDomNode->getBlock()))
255 Orders.
push_back(ChildDomNode->getBlock());
260 using InsertPtsCostPair =
267 for (
auto RIt = Orders.
rbegin(); RIt != Orders.
rend(); RIt++) {
269 bool NodeInBBs = BBs.count(Node);
270 auto &InsertPts = InsertPtsMap[Node].first;
271 BlockFrequency &InsertPtsFreq = InsertPtsMap[Node].second;
277 (InsertPtsFreq == BFI.
getBlockFreq(Node) && InsertPts.size() > 1))
280 BBs.insert(InsertPts.begin(), InsertPts.end());
287 auto &ParentInsertPts = InsertPtsMap[Parent].first;
288 BlockFrequency &ParentPtsFreq = InsertPtsMap[Parent].second;
298 (InsertPtsFreq == BFI.
getBlockFreq(Node) && InsertPts.size() > 1)))) {
299 ParentInsertPts.
insert(Node);
302 ParentInsertPts.insert(InsertPts.begin(), InsertPts.end());
303 ParentPtsFreq += InsertPtsFreq;
316 for (
auto const &U : RCI.Uses)
317 BBs.
insert(findMatInsertPt(U.Inst, U.OpndIdx)->getParent());
319 if (BBs.count(
Entry)) {
326 for (
auto BB : BBs) {
328 for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)
330 InsertPts.
insert(&*InsertPt);
335 while (BBs.size() >= 2) {
337 BB1 = BBs.pop_back_val();
338 BB2 = BBs.pop_back_val();
339 BB = DT->findNearestCommonDominator(BB1, BB2);
346 assert((BBs.size() == 1) &&
"Expected only one element.");
348 InsertPts.
insert(findMatInsertPt(&FirstInst));
358 void ConstantHoistingPass::collectConstantCandidates(
359 ConstCandMapType &ConstCandMap,
Instruction *Inst,
unsigned Idx,
364 if (
auto IntrInst = dyn_cast<IntrinsicInst>(Inst))
365 Cost = TTI->getIntImmCostIntrin(IntrInst->getIntrinsicID(), Idx,
373 ConstCandMapType::iterator Itr;
375 ConstPtrUnionType Cand = ConstInt;
376 std::tie(Itr, Inserted) = ConstCandMap.insert(std::make_pair(Cand, 0));
379 Itr->second = ConstIntCandVec.size() - 1;
381 ConstIntCandVec[Itr->second].addUser(Inst, Idx, Cost);
383 <<
"Collect constant " << *ConstInt <<
" from " << *Inst
384 <<
" with cost " << Cost <<
'\n';
385 else dbgs() <<
"Collect constant " << *ConstInt
386 <<
" indirectly from " << *Inst <<
" via " 387 << *Inst->
getOperand(Idx) <<
" with cost " << Cost
393 void ConstantHoistingPass::collectConstantCandidates(
394 ConstCandMapType &ConstCandMap,
Instruction *Inst,
unsigned Idx,
407 APInt Offset(DL->getTypeSizeInBits(PtrIntTy), 0,
true);
408 auto *GEPO = cast<GEPOperator>(ConstExpr);
409 if (!GEPO->accumulateConstantOffset(*DL,
Offset))
420 ConstCandVecType &ExprCandVec = ConstGEPCandMap[BaseGV];
421 ConstCandMapType::iterator Itr;
423 ConstPtrUnionType Cand = ConstExpr;
424 std::tie(Itr, Inserted) = ConstCandMap.insert(std::make_pair(Cand, 0));
429 Itr->second = ExprCandVec.size() - 1;
431 ExprCandVec[Itr->second].addUser(Inst, Idx, Cost);
435 void ConstantHoistingPass::collectConstantCandidates(
436 ConstCandMapType &ConstCandMap,
Instruction *Inst,
unsigned Idx) {
440 if (
auto ConstInt = dyn_cast<ConstantInt>(Opnd)) {
441 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
446 if (
auto CastInst = dyn_cast<Instruction>(Opnd)) {
455 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
461 if (
auto ConstExpr = dyn_cast<ConstantExpr>(Opnd)) {
464 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstExpr);
470 if (
auto ConstInt = dyn_cast<ConstantInt>(ConstExpr->
getOperand(0))) {
473 collectConstantCandidates(ConstCandMap, Inst, Idx, ConstInt);
481 void ConstantHoistingPass::collectConstantCandidates(
482 ConstCandMapType &ConstCandMap,
Instruction *Inst) {
495 collectConstantCandidates(ConstCandMap, Inst, Idx);
502 void ConstantHoistingPass::collectConstantCandidates(
Function &Fn) {
503 ConstCandMapType ConstCandMap;
506 if (!DT->isReachableFromEntry(&BB))
509 collectConstantCandidates(ConstCandMap, &Inst);
524 if (LimVal1 == ~0ULL || LimVal2 == ~0ULL)
527 uint64_t Diff = LimVal1 - LimVal2;
528 return APInt(BW, Diff,
true);
555 ConstantHoistingPass::maximizeConstantsInRange(ConstCandVecType::iterator S,
556 ConstCandVecType::iterator
E,
557 ConstCandVecType::iterator &MaxCostItr) {
558 unsigned NumUses = 0;
560 bool OptForSize =
Entry->getParent()->hasOptSize() ||
563 if (!OptForSize || std::distance(S,E) > 100) {
564 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
565 NumUses += ConstCand->Uses.size();
566 if (ConstCand->CumulativeCost > MaxCostItr->CumulativeCost)
567 MaxCostItr = ConstCand;
574 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
575 auto Value = ConstCand->ConstInt->getValue();
576 Type *Ty = ConstCand->ConstInt->getType();
578 NumUses += ConstCand->Uses.size();
579 LLVM_DEBUG(
dbgs() <<
"= Constant: " << ConstCand->ConstInt->getValue()
582 for (
auto User : ConstCand->Uses) {
583 unsigned Opcode =
User.Inst->getOpcode();
584 unsigned OpndIdx =
User.OpndIdx;
585 Cost += TTI->getIntImmCostInst(Opcode, OpndIdx,
Value, Ty);
588 for (
auto C2 = S; C2 !=
E; ++C2) {
590 C2->ConstInt->getValue(),
591 ConstCand->ConstInt->getValue());
594 TTI->getIntImmCodeSizeCost(Opcode, OpndIdx, Diff.
getValue(), Ty);
597 <<
"has penalty: " << ImmCosts <<
"\n" 598 <<
"Adjusted cost: " << Cost <<
"\n");
603 if (Cost > MaxCost) {
605 MaxCostItr = ConstCand;
606 LLVM_DEBUG(
dbgs() <<
"New candidate: " << MaxCostItr->ConstInt->getValue()
615 void ConstantHoistingPass::findAndMakeBaseConstant(
616 ConstCandVecType::iterator S, ConstCandVecType::iterator E,
619 unsigned NumUses = maximizeConstantsInRange(S, E, MaxCostItr);
633 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
634 APInt Diff = ConstCand->ConstInt->getValue() - ConstInt->
getValue();
637 ConstCand->ConstExpr ? ConstCand->ConstExpr->getType() :
nullptr;
641 ConstInfoVec.
push_back(std::move(ConstInfo));
646 void ConstantHoistingPass::findBaseConstants(
GlobalVariable *BaseGV) {
649 ConstCandVecType &ConstCandVec = BaseGV ?
650 ConstGEPCandMap[BaseGV] : ConstIntCandVec;
651 ConstInfoVecType &ConstInfoVec = BaseGV ?
652 ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
665 auto MinValItr = ConstCandVec.begin();
666 for (
auto CC = std::next(ConstCandVec.begin()), E = ConstCandVec.end();
668 if (MinValItr->ConstInt->getType() == CC->ConstInt->getType()) {
669 Type *MemUseValTy =
nullptr;
670 for (
auto &U : CC->Uses) {
672 if (
LoadInst *LI = dyn_cast<LoadInst>(UI)) {
673 MemUseValTy = LI->getType();
675 }
else if (
StoreInst *
SI = dyn_cast<StoreInst>(UI)) {
677 if (
SI->getPointerOperand() ==
SI->getOperand(U.OpndIdx)) {
678 MemUseValTy =
SI->getValueOperand()->getType();
685 APInt Diff = CC->ConstInt->getValue() - MinValItr->ConstInt->getValue();
690 (!MemUseValTy || TTI->isLegalAddressingMode(MemUseValTy,
697 findAndMakeBaseConstant(MinValItr, CC, ConstInfoVec);
702 findAndMakeBaseConstant(MinValItr, ConstCandVec.end(), ConstInfoVec);
712 if (
auto PHI = dyn_cast<PHINode>(Inst)) {
719 BasicBlock *IncomingBB = PHI->getIncomingBlock(Idx);
720 for (
unsigned i = 0; i < Idx; ++i) {
721 if (PHI->getIncomingBlock(i) == IncomingBB) {
722 Value *IncomingVal = PHI->getIncomingValue(i);
742 if (!Offset && Ty && Ty != Base->
getType())
751 cast<PointerType>(Ty)->getAddressSpace());
752 Base =
new BitCastInst(Base, Int8PtrTy,
"base_bitcast", InsertionPt);
754 Offset,
"mat_gep", InsertionPt);
755 Mat =
new BitCastInst(Mat, Ty,
"mat_bitcast", InsertionPt);
759 "const_mat", InsertionPt);
762 <<
" + " << *Offset <<
") in BB " 770 if (isa<ConstantInt>(Opnd)) {
779 if (
auto CastInst = dyn_cast<Instruction>(Opnd)) {
784 if (!ClonedCastInst) {
787 ClonedCastInst->insertAfter(
CastInst);
791 <<
"To : " << *ClonedCastInst <<
'\n');
801 if (
auto ConstExpr = dyn_cast<ConstantExpr>(Opnd)) {
809 assert(ConstExpr->
isCast() &&
"ConstExpr should be a cast");
812 ConstExprInst->insertBefore(findMatInsertPt(ConstUser.
Inst,
818 LLVM_DEBUG(
dbgs() <<
"Create instruction: " << *ConstExprInst <<
'\n' 819 <<
"From : " << *ConstExpr <<
'\n');
822 ConstExprInst->eraseFromParent();
833 bool ConstantHoistingPass::emitBaseConstants(
GlobalVariable *BaseGV) {
834 bool MadeChange =
false;
836 BaseGV ? ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
837 for (
auto const &ConstInfo : ConstInfoVec) {
843 unsigned UsesNum = 0;
844 unsigned ReBasesNum = 0;
845 unsigned NotRebasedNum = 0;
849 using RebasedUse = std::tuple<Constant *, Type *, ConstantUser>;
852 for (
auto const &U : RCI.Uses) {
855 findMatInsertPt(U.Inst, U.OpndIdx)->
getParent();
858 if (IPSet.size() == 1 ||
859 DT->dominates(IP->getParent(), OrigMatInsertBB))
860 ToBeRebased.
push_back(RebasedUse(RCI.Offset, RCI.Ty, U));
868 NotRebasedNum += ToBeRebased.
size();
876 assert(BaseGV &&
"A base constant expression must have an base GV");
887 <<
") to BB " << IP->getParent()->
getName() <<
'\n' 891 for (
auto const &R : ToBeRebased) {
893 Type *Ty = std::get<1>(R);
895 emitBaseConstants(Base, Off, Ty, U);
903 "All uses should be instructions.");
909 assert(UsesNum == (ReBasesNum + NotRebasedNum) &&
910 "Not all uses are rebased");
912 NumConstantsHoisted++;
925 void ConstantHoistingPass::deleteDeadCastInst()
const {
926 for (
auto const &
I : ClonedCastMap)
927 if (
I.first->use_empty())
928 I.first->eraseFromParent();
940 this->Entry = &Entry;
943 collectConstantCandidates(Fn);
947 if (!ConstIntCandVec.empty())
948 findBaseConstants(
nullptr);
949 for (
auto &MapEntry : ConstGEPCandMap)
950 if (!MapEntry.second.empty())
951 findBaseConstants(MapEntry.first);
955 bool MadeChange =
false;
956 if (!ConstIntInfoVec.empty())
957 MadeChange = emitBaseConstants(
nullptr);
958 for (
auto MapEntry : ConstGEPInfoMap)
959 if (!MapEntry.second.empty())
960 MadeChange |= emitBaseConstants(MapEntry.first);
964 deleteDeadCastInst();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
static bool runImpl(Function &F, TargetLibraryInfo &TLI, DominatorTree &DT)
This is the entry point for all transforms.
INITIALIZE_PASS_BEGIN(ConstantHoistingLegacyPass, "consthoist", "Constant Hoisting", false, false) INITIALIZE_PASS_END(ConstantHoistingLegacyPass
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A base constant and all its rebased constants.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
void initializeConstantHoistingLegacyPassPass(PassRegistry &)
static const DILocation * getMergedLocation(const DILocation *LocA, const DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
void push_back(const T &Elt)
Analysis providing profile information.
static GetElementPtrInst * Create(Type *PointeeType, Value *Ptr, ArrayRef< Value *> IdxList, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Keeps track of a constant candidate and its uses.
Analysis pass providing the TargetTransformInfo.
static bool updateOperand(Instruction *Inst, unsigned Idx, Instruction *Mat)
Updates the operand at Idx in instruction Inst with the result of instruction Mat.
static cl::opt< unsigned > MinNumOfDependentToRebase("consthoist-min-num-to-rebase", cl::desc("Do not rebase if number of dependent constants of a Base is less " "than this number."), cl::init(0), cl::Hidden)
STATISTIC(NumFunctions, "Total number of functions")
Analysis pass which computes a DominatorTree.
static void cleanup(BlockFrequencyInfoImplBase &BFI)
Clear all memory not needed downstream.
An instruction for reading from memory.
bool isVectorTy() const
True if this is an instance of VectorType.
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
This represents a constant that has been rebased with respect to a base constant. ...
unsigned getBitWidth() const
Return the number of bits in the APInt.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Instruction * getAsInstruction() const
Returns an Instruction which implements the same operation as this ConstantExpr.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
This is the base class for all instructions that perform data casts.
static cl::opt< bool > ConstHoistGEP("consthoist-gep", cl::init(false), cl::Hidden, cl::desc("Try hoisting constant gep expressions"))
Legacy analysis pass which computes BlockFrequencyInfo.
This file implements a class to represent arbitrary precision integral constant values and operations...
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following: ...
A constant value that is initialized with an expression using other constant values.
int64_t getSExtValue() const
Get sign extended value.
Type * getType() const
All values are typed, get the type of this value.
bool insert(const value_type &X)
Insert a new element into the SetVector.
const T & getValue() const LLVM_LVALUE_FUNCTION
This class represents a no-op cast from one type to another.
const std::vector< DomTreeNodeBase * > & getChildren() const
const APInt & getValue() const
Return the constant as an APInt value reference.
bool isGEPWithNoNotionalOverIndexing() const
Return true if this is a getelementptr expression and all the index operands are compile-time known i...
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
An instruction for storing to memory.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Value * getOperand(unsigned i) const
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
Class to represent pointers.
const BasicBlock & getEntryBlock() const
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
static bool runOnFunction(Function &F, bool PostInlining)
initializer< Ty > init(const Ty &Val)
A set of analyses that are preserved following a run of a transformation pass.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
DomTreeNodeBase * getIDom() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
bool canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx)
Given an instruction, is it legal to set operand OpIdx to a non-constant value?
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Class to represent integer types.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static cl::opt< bool > ConstHoistWithBlockFrequency("consthoist-with-block-frequency", cl::init(true), cl::Hidden, cl::desc("Enable the use of the block frequency analysis to reduce the " "chance to execute const materialization more frequently than " "without hoisting."))
DomTreeNodeBase< NodeT > * getNode(const NodeT *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Keeps track of the user of a constant and the operand index where the constant is used...
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)
Optimize expensive integer constants in the given function.
Analysis pass which computes BlockFrequencyInfo.
Iterator for intrusive lists based on ilist_node.
unsigned getNumOperands() const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Instruction * user_back()
Specialize the methods defined in Value, as we know that an instruction can only be used by other ins...
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.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
static Optional< APInt > calculateOffsetDiff(const APInt &V1, const APInt &V2)
BlockFrequency getBlockFreq(const BasicBlock *BB) const
getblockFreq - Return block frequency.
void setOperand(unsigned i, Value *Val)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Class for arbitrary precision integers.
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=nullptr)
Construct a binary instruction, given the opcode and the two operands.
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...
Represents analyses that only rely on functions' control flow.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM_NODISCARD bool empty() const
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value...
void preserveSet()
Mark an analysis set as preserved.
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
bool empty() const
Determine if the SetVector is empty or not.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
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...
reverse_iterator rbegin()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void stable_sort(R &&Range)
bool isEHPad() const
Return true if this basic block is an exception handling block.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
A vector that has set insertion semantics.
bool isCast() const
Return true if this is a convert constant expression.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
RebasedConstantListType RebasedConstants
Legacy analysis pass which computes a DominatorTree.
Type * getElementType() const
PointerType * getType() const
Global values are always pointers.
const BasicBlock * getParent() const
FunctionPass * createConstantHoistingPass()