75#define DEBUG_TYPE "consthoist"
77STATISTIC(NumConstantsHoisted,
"Number of constants hoisted");
78STATISTIC(NumConstantsRebased,
"Number of constants rebased");
82 cl::desc(
"Enable the use of the block frequency analysis to reduce the "
83 "chance to execute const materialization more frequently than "
84 "without hoisting."));
88 cl::desc(
"Try hoisting constant gep expressions"));
92 cl::desc(
"Do not rebase if number of dependent constants of a Base is less "
126char ConstantHoistingLegacyPass::ID = 0;
129 "Constant Hoisting",
false,
false)
138 return new ConstantHoistingLegacyPass();
142bool ConstantHoistingLegacyPass::runOnFunction(
Function &Fn) {
143 if (skipFunction(Fn))
146 LLVM_DEBUG(
dbgs() <<
"********** Begin Constant Hoisting **********\n");
150 Impl.runImpl(Fn, getAnalysis<TargetTransformInfoWrapperPass>().getTTI(Fn),
151 getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
153 ? &getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI()
156 &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI());
158 LLVM_DEBUG(
dbgs() <<
"********** End Constant Hoisting **********\n");
163void ConstantHoistingPass::collectMatInsertPts(
173 unsigned Idx)
const {
178 if (
auto CastInst = dyn_cast<Instruction>(Opnd))
184 if (!isa<PHINode>(Inst) && !Inst->
isEHPad())
189 assert(Entry != Inst->
getParent() &&
"PHI or landing pad in entry block!");
191 if (
Idx != ~0U && isa<PHINode>(Inst)) {
192 InsertionBlock = cast<PHINode>(Inst)->getIncomingBlock(
Idx);
193 if (!InsertionBlock->
isEHPad()) {
204 while (IDom->getBlock()->isEHPad()) {
205 assert(Entry != IDom->getBlock() &&
"eh pad in entry block");
206 IDom = IDom->getIDom();
209 return IDom->getBlock()->getTerminator();
218 assert(!BBs.
count(Entry) &&
"Assume Entry is not in BBs");
225 for (
auto *BB : BBs) {
242 "Entry doens't dominate current Node");
252 Candidates.
insert(Path.begin(), Path.end());
263 if (Candidates.
count(ChildDomNode->getBlock()))
264 Orders.
push_back(ChildDomNode->getBlock());
269 using InsertPtsCostPair =
278 auto &InsertPts = InsertPtsMap[
Node].first;
284 if (InsertPtsFreq > BFI.getBlockFreq(
Node) ||
285 (InsertPtsFreq == BFI.getBlockFreq(
Node) && InsertPts.size() > 1))
288 BBs.
insert(InsertPts.begin(), InsertPts.end());
295 auto &ParentInsertPts = InsertPtsMap[Parent].first;
305 (InsertPtsFreq > BFI.getBlockFreq(
Node) ||
306 (InsertPtsFreq == BFI.getBlockFreq(
Node) && InsertPts.size() > 1)))) {
308 ParentPtsFreq += BFI.getBlockFreq(
Node);
310 ParentInsertPts.insert(InsertPts.begin(), InsertPts.end());
311 ParentPtsFreq += InsertPtsFreq;
326 BBs.
insert(MatInsertPt->getParent());
328 if (BBs.
count(Entry)) {
336 InsertPts.
insert(&*BB->getFirstInsertionPt());
340 while (BBs.size() >= 2) {
342 BB1 = BBs.pop_back_val();
343 BB2 = BBs.pop_back_val();
351 assert((BBs.size() == 1) &&
"Expected only one element.");
353 InsertPts.
insert(findMatInsertPt(&FirstInst));
363void ConstantHoistingPass::collectConstantCandidates(
369 if (
auto IntrInst = dyn_cast<IntrinsicInst>(Inst))
382 ConstPtrUnionType Cand = ConstInt;
383 std::tie(Itr, Inserted) = ConstCandMap.insert(std::make_pair(Cand, 0));
386 Itr->second = ConstIntCandVec.size() - 1;
390 <<
"Collect constant " << *ConstInt <<
" from " << *Inst
391 <<
" with cost " <<
Cost <<
'\n';
392 else dbgs() <<
"Collect constant " << *ConstInt
393 <<
" indirectly from " << *Inst <<
" via "
400void ConstantHoistingPass::collectConstantCandidates(
415 auto *GEPO = cast<GEPOperator>(ConstExpr);
421 if (!GEPO->isInBounds())
424 if (!GEPO->accumulateConstantOffset(*DL,
Offset))
437 ConstCandVecType &ExprCandVec = ConstGEPCandMap[BaseGV];
440 ConstPtrUnionType Cand = ConstExpr;
441 std::tie(Itr, Inserted) = ConstCandMap.insert(std::make_pair(Cand, 0));
446 Itr->second = ExprCandVec.size() - 1;
452void ConstantHoistingPass::collectConstantCandidates(
453 ConstCandMapType &ConstCandMap,
Instruction *Inst,
unsigned Idx) {
457 if (
auto ConstInt = dyn_cast<ConstantInt>(Opnd)) {
458 collectConstantCandidates(ConstCandMap, Inst,
Idx, ConstInt);
463 if (
auto CastInst = dyn_cast<Instruction>(Opnd)) {
472 collectConstantCandidates(ConstCandMap, Inst,
Idx, ConstInt);
478 if (
auto ConstExpr = dyn_cast<ConstantExpr>(Opnd)) {
481 collectConstantCandidates(ConstCandMap, Inst,
Idx, ConstExpr);
487 if (
auto ConstInt = dyn_cast<ConstantInt>(ConstExpr->
getOperand(0))) {
490 collectConstantCandidates(ConstCandMap, Inst,
Idx, ConstInt);
498void ConstantHoistingPass::collectConstantCandidates(
499 ConstCandMapType &ConstCandMap,
Instruction *Inst) {
512 collectConstantCandidates(ConstCandMap, Inst,
Idx);
519void ConstantHoistingPass::collectConstantCandidates(
Function &Fn) {
520 ConstCandMapType ConstCandMap;
526 collectConstantCandidates(ConstCandMap, &Inst);
536 std::optional<APInt> Res;
537 unsigned BW = V1.
getBitWidth() > V2.getBitWidth() ?
540 uint64_t LimVal2 = V2.getLimitedValue();
542 if (LimVal1 == ~0ULL || LimVal2 == ~0ULL)
546 return APInt(BW, Diff,
true);
573ConstantHoistingPass::maximizeConstantsInRange(ConstCandVecType::iterator S,
574 ConstCandVecType::iterator
E,
575 ConstCandVecType::iterator &MaxCostItr) {
576 unsigned NumUses = 0;
581 if (!OptForSize || std::distance(S,
E) > 100) {
582 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
583 NumUses += ConstCand->Uses.size();
584 if (ConstCand->CumulativeCost > MaxCostItr->CumulativeCost)
585 MaxCostItr = ConstCand;
592 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
593 auto Value = ConstCand->ConstInt->getValue();
594 Type *Ty = ConstCand->ConstInt->getType();
596 NumUses += ConstCand->Uses.size();
597 LLVM_DEBUG(
dbgs() <<
"= Constant: " << ConstCand->ConstInt->getValue()
600 for (
auto User : ConstCand->Uses) {
602 unsigned OpndIdx =
User.OpndIdx;
607 for (
auto C2 = S; C2 !=
E; ++C2) {
609 C2->ConstInt->getValue(), ConstCand->ConstInt->getValue());
615 <<
"has penalty: " << ImmCosts <<
"\n"
616 <<
"Adjusted cost: " <<
Cost <<
"\n");
621 if (
Cost > MaxCost) {
623 MaxCostItr = ConstCand;
624 LLVM_DEBUG(
dbgs() <<
"New candidate: " << MaxCostItr->ConstInt->getValue()
633void ConstantHoistingPass::findAndMakeBaseConstant(
634 ConstCandVecType::iterator S, ConstCandVecType::iterator
E,
637 unsigned NumUses = maximizeConstantsInRange(S,
E, MaxCostItr);
651 for (
auto ConstCand = S; ConstCand !=
E; ++ConstCand) {
652 APInt Diff = ConstCand->ConstInt->getValue() - ConstInt->
getValue();
655 ConstCand->ConstExpr ? ConstCand->ConstExpr->getType() :
nullptr;
659 ConstInfoVec.
push_back(std::move(ConstInfo));
664void ConstantHoistingPass::findBaseConstants(
GlobalVariable *BaseGV) {
667 ConstCandVecType &ConstCandVec = BaseGV ?
668 ConstGEPCandMap[BaseGV] : ConstIntCandVec;
669 ConstInfoVecType &ConstInfoVec = BaseGV ?
670 ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
676 return LHS.ConstInt->
getType()->getBitWidth() <
678 return LHS.ConstInt->getValue().ult(
RHS.ConstInt->getValue());
683 auto MinValItr = ConstCandVec.begin();
684 for (
auto CC = std::next(ConstCandVec.begin()),
E = ConstCandVec.end();
686 if (MinValItr->ConstInt->getType() ==
CC->ConstInt->getType()) {
687 Type *MemUseValTy =
nullptr;
688 for (
auto &U :
CC->Uses) {
690 if (
LoadInst *LI = dyn_cast<LoadInst>(UI)) {
691 MemUseValTy = LI->getType();
693 }
else if (
StoreInst *SI = dyn_cast<StoreInst>(UI)) {
695 if (
SI->getPointerOperand() ==
SI->getOperand(
U.OpndIdx)) {
696 MemUseValTy =
SI->getValueOperand()->getType();
703 APInt Diff =
CC->ConstInt->getValue() - MinValItr->ConstInt->getValue();
715 findAndMakeBaseConstant(MinValItr,
CC, ConstInfoVec);
720 findAndMakeBaseConstant(MinValItr, ConstCandVec.end(), ConstInfoVec);
730 if (
auto PHI = dyn_cast<PHINode>(Inst)) {
738 for (
unsigned i = 0; i <
Idx; ++i) {
739 if (
PHI->getIncomingBlock(i) == IncomingBB) {
740 Value *IncomingVal =
PHI->getIncomingValue(i);
754 UserAdjustment *Adj) {
758 if (!Adj->Offset && Adj->Ty && Adj->Ty !=
Base->getType())
765 "mat_gep", Adj->MatInsertPt);
767 Mat =
new BitCastInst(Mat, Adj->Ty,
"mat_bitcast", Adj->MatInsertPt);
771 "const_mat", Adj->MatInsertPt);
774 <<
" + " << *Adj->Offset <<
") in BB "
779 Value *Opnd = Adj->User.Inst->getOperand(Adj->User.OpndIdx);
782 if (isa<ConstantInt>(Opnd)) {
784 if (!
updateOperand(Adj->User.Inst, Adj->User.OpndIdx, Mat) && Adj->Offset)
791 if (
auto CastInst = dyn_cast<Instruction>(Opnd)) {
796 if (!ClonedCastInst) {
803 <<
"To : " << *ClonedCastInst <<
'\n');
807 updateOperand(Adj->User.Inst, Adj->User.OpndIdx, ClonedCastInst);
813 if (
auto ConstExpr = dyn_cast<ConstantExpr>(Opnd)) {
814 if (isa<GEPOperator>(ConstExpr)) {
821 assert(ConstExpr->
isCast() &&
"ConstExpr should be a cast");
826 ConstExprInst->
setDebugLoc(Adj->User.Inst->getDebugLoc());
828 LLVM_DEBUG(
dbgs() <<
"Create instruction: " << *ConstExprInst <<
'\n'
829 <<
"From : " << *ConstExpr <<
'\n');
831 if (!
updateOperand(Adj->User.Inst, Adj->User.OpndIdx, ConstExprInst)) {
843bool ConstantHoistingPass::emitBaseConstants(
GlobalVariable *BaseGV) {
844 bool MadeChange =
false;
846 BaseGV ? ConstGEPInfoMap[BaseGV] : ConstIntInfoVec;
851 findConstantInsertionPoint(ConstInfo, MatInsertPts);
856 unsigned UsesNum = 0;
857 unsigned ReBasesNum = 0;
858 unsigned NotRebasedNum = 0;
865 UsesNum += RCI.Uses.size();
866 for (
auto const &U : RCI.Uses) {
871 if (IPSet.size() == 1 ||
872 DT->
dominates(IP->getParent(), OrigMatInsertBB))
873 ToBeRebased.
emplace_back(RCI.Offset, RCI.Ty, MatInsertPt, U);
880 NotRebasedNum += ToBeRebased.
size();
888 assert(BaseGV &&
"A base constant expression must have an base GV");
896 Base->setDebugLoc(IP->getDebugLoc());
899 <<
") to BB " << IP->getParent()->
getName() <<
'\n'
903 for (UserAdjustment &R : ToBeRebased) {
904 emitBaseConstants(
Base, &R);
908 Base->getDebugLoc(),
R.User.Inst->getDebugLoc()));
910 assert(!
Base->use_empty() &&
"The use list is empty!?");
912 "All uses should be instructions.");
918 assert(UsesNum == (ReBasesNum + NotRebasedNum) &&
919 "Not all uses are rebased");
921 NumConstantsHoisted++;
934void ConstantHoistingPass::deleteDeadCastInst()
const {
935 for (
auto const &
I : ClonedCastMap)
936 if (
I.first->use_empty())
937 I.first->eraseFromParent();
949 this->Entry = &Entry;
952 collectConstantCandidates(Fn);
956 if (!ConstIntCandVec.empty())
957 findBaseConstants(
nullptr);
958 for (
const auto &MapEntry : ConstGEPCandMap)
959 if (!MapEntry.second.empty())
960 findBaseConstants(MapEntry.first);
964 bool MadeChange =
false;
965 if (!ConstIntInfoVec.
empty())
966 MadeChange = emitBaseConstants(
nullptr);
967 for (
const auto &MapEntry : ConstGEPInfoMap)
968 if (!MapEntry.second.empty())
969 MadeChange |= emitBaseConstants(MapEntry.first);
973 deleteDeadCastInst();
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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...
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)
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."))
static cl::opt< bool > ConstHoistGEP("consthoist-gep", cl::init(false), cl::Hidden, cl::desc("Try hoisting constant gep expressions"))
static std::optional< APInt > calculateOffsetDiff(const APInt &V1, const APInt &V2)
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
This file defines the DenseMap class.
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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)
static constexpr uint32_t Opcode
Class for arbitrary precision integers.
unsigned getBitWidth() const
Return the number of bits in the APInt.
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.
int64_t getSExtValue() const
Get sign extended value.
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesCFG()
This function should be called by the pass, iff they do not:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
const Instruction & front() const
const Function * getParent() const
Return the enclosing method, or null if none.
bool isEHPad() const
Return true if this basic block is an exception handling block.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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.
This class represents a no-op cast from one type to another.
Analysis pass which computes BlockFrequencyInfo.
Legacy analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Represents analyses that only rely on functions' control flow.
This is the base class for all instructions that perform data casts.
A constant value that is initialized with an expression using other constant values.
bool isCast() const
Return true if this is a convert constant expression.
Instruction * getAsInstruction(Instruction *InsertBefore=nullptr) const
Returns an Instruction which implements the same operation as this ConstantExpr.
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT, BlockFrequencyInfo *BFI, BasicBlock &Entry, ProfileSummaryInfo *PSI)
Optimize expensive integer constants in the given function.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This is the shared class of boolean and integer constants.
IntegerType * getType() const
getType - Specialize the getType() method to always return an IntegerType, which reduces the amount o...
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.
const APInt & getValue() const
Return the constant as an APInt value reference.
This is an important base class in LLVM.
static DILocation * getMergedLocation(DILocation *LocA, DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
IntegerType * getIndexType(LLVMContext &C, unsigned AddressSpace) const
Returns the type of a GEP index in AddressSpace.
TypeSize getTypeSizeInBits(Type *Ty) const
Size examples:
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again.
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.
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
Instruction * findNearestCommonDominator(Instruction *I1, Instruction *I2) const
Find the nearest instruction I that dominates both I1 and I2, in the sense that a result produced bef...
bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
const BasicBlock & getEntryBlock() const
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
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="", Instruction *InsertBefore=nullptr)
Module * getParent()
Get the module that this global value is contained inside of...
PointerType * getType() const
Global values are always pointers.
std::optional< CostType > getValue() const
This function is intended to be used as sparingly as possible, since the class provides the full rang...
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following:
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
const BasicBlock * getParent() const
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.
void insertAfter(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately after the specified instruction.
Class to represent integer types.
An instruction for reading from memory.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
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.
void 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 clear()
Completely clear the SetVector.
size_type count(const key_type &key) const
Count the number of elements of a given key in 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.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
Analysis pass providing the TargetTransformInfo.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
static IntegerType * getInt8Ty(LLVMContext &C)
static IntegerType * getInt32Ty(LLVMContext &C)
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.
StringRef getName() const
Return a constant reference to the value's name.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
FunctionPass * createConstantHoistingPass()
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.
auto reverse(ContainerTy &&C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx)
Given an instruction, is it legal to set operand OpIdx to a non-constant value?
void initializeConstantHoistingLegacyPassPass(PassRegistry &)
Keeps track of a constant candidate and its uses.
A base constant and all its rebased constants.
RebasedConstantListType RebasedConstants
Keeps track of the user of a constant and the operand index where the constant is used.
This represents a constant that has been rebased with respect to a base constant.