本文整理汇总了C++中LoadInst::users方法的典型用法代码示例。如果您正苦于以下问题:C++ LoadInst::users方法的具体用法?C++ LoadInst::users怎么用?C++ LoadInst::users使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadInst
的用法示例。
在下文中一共展示了LoadInst::users方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EstimateNumberOfSimplifiedInsns
// Given a list of loads that could be constant-folded (LoadBaseAddresses),
// estimate number of optimized instructions after substituting the concrete
// values for the given Iteration.
// Fill in SimplifiedInsns map for future use in DCE-estimation.
unsigned EstimateNumberOfSimplifiedInsns(unsigned Iteration) {
SmallVector<Instruction *, 8> Worklist;
SimplifiedValues.clear();
CountedInsns.clear();
NumberOfOptimizedInstructions = 0;
// We start by adding all loads to the worklist.
for (auto LoadDescr : LoadBaseAddresses) {
LoadInst *LI = LoadDescr.first;
SimplifiedValues[LI] = computeLoadValue(LI, Iteration);
if (CountedInsns.insert(LI).second)
NumberOfOptimizedInstructions += TTI.getUserCost(LI);
for (auto U : LI->users()) {
Instruction *UI = dyn_cast<Instruction>(U);
if (!UI)
continue;
if (!L->contains(UI))
continue;
Worklist.push_back(UI);
}
}
// And then we try to simplify every user of every instruction from the
// worklist. If we do simplify a user, add it to the worklist to process
// its users as well.
while (!Worklist.empty()) {
Instruction *I = Worklist.pop_back_val();
if (!visit(I))
continue;
for (auto U : I->users()) {
Instruction *UI = dyn_cast<Instruction>(U);
if (!UI)
continue;
if (!L->contains(UI))
continue;
Worklist.push_back(UI);
}
}
return NumberOfOptimizedInstructions;
}