forked from OSchip/llvm-project
ArgPromotion: Allow setting MaxElements in the new-style pass
llvm-svn: 322025
This commit is contained in:
parent
a12bf9106a
commit
92fe563b57
|
@ -22,7 +22,11 @@ namespace llvm {
|
||||||
/// transform it and all of its callers to replace indirect arguments with
|
/// transform it and all of its callers to replace indirect arguments with
|
||||||
/// direct (by-value) arguments.
|
/// direct (by-value) arguments.
|
||||||
class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
|
class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
|
||||||
|
unsigned MaxElements;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {}
|
||||||
|
|
||||||
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
|
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
|
||||||
LazyCallGraph &CG, CGSCCUpdateResult &UR);
|
LazyCallGraph &CG, CGSCCUpdateResult &UR);
|
||||||
};
|
};
|
||||||
|
|
|
@ -963,7 +963,7 @@ PreservedAnalyses ArgumentPromotionPass::run(LazyCallGraph::SCC &C,
|
||||||
return FAM.getResult<AAManager>(F);
|
return FAM.getResult<AAManager>(F);
|
||||||
};
|
};
|
||||||
|
|
||||||
Function *NewF = promoteArguments(&OldF, AARGetter, 3u, None);
|
Function *NewF = promoteArguments(&OldF, AARGetter, MaxElements, None);
|
||||||
if (!NewF)
|
if (!NewF)
|
||||||
continue;
|
continue;
|
||||||
LocalChange = true;
|
LocalChange = true;
|
||||||
|
|
Loading…
Reference in New Issue