OSDN Git Service

ArgPromotion: Allow setting MaxElements in the new-style pass
authorJustin Bogner <mail@justinbogner.com>
Mon, 8 Jan 2018 21:13:35 +0000 (21:13 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 8 Jan 2018 21:13:35 +0000 (21:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322025 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 82ffc69..49ca6cc 100644 (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);
 };
index b25cbca..d3a7b0e 100644 (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;