ArgPromotion: Allow setting MaxElements in the new-style pass

llvm-svn: 322025
This commit is contained in:
Justin Bogner 2018-01-08 21:13:35 +00:00
parent a12bf9106a
commit 92fe563b57
2 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,11 @@ namespace llvm {
/// transform it and all of its callers to replace indirect arguments with
/// direct (by-value) arguments.
class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
unsigned MaxElements;
public:
ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {}
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
LazyCallGraph &CG, CGSCCUpdateResult &UR);
};

View File

@ -963,7 +963,7 @@ PreservedAnalyses ArgumentPromotionPass::run(LazyCallGraph::SCC &C,
return FAM.getResult<AAManager>(F);
};
Function *NewF = promoteArguments(&OldF, AARGetter, 3u, None);
Function *NewF = promoteArguments(&OldF, AARGetter, MaxElements, None);
if (!NewF)
continue;
LocalChange = true;