Skip to content

Commit 92fe563

Browse files
committed
ArgPromotion: Allow setting MaxElements in the new-style pass
llvm-svn: 322025
1 parent a12bf91 commit 92fe563

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

llvm/include/llvm/Transforms/IPO/ArgumentPromotion.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ namespace llvm {
2222
/// transform it and all of its callers to replace indirect arguments with
2323
/// direct (by-value) arguments.
2424
class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
25+
unsigned MaxElements;
26+
2527
public:
28+
ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {}
29+
2630
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
2731
LazyCallGraph &CG, CGSCCUpdateResult &UR);
2832
};

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ PreservedAnalyses ArgumentPromotionPass::run(LazyCallGraph::SCC &C,
963963
return FAM.getResult<AAManager>(F);
964964
};
965965

966-
Function *NewF = promoteArguments(&OldF, AARGetter, 3u, None);
966+
Function *NewF = promoteArguments(&OldF, AARGetter, MaxElements, None);
967967
if (!NewF)
968968
continue;
969969
LocalChange = true;

0 commit comments

Comments
 (0)