[llvm] r199005 - [PM] Actually nest pass managers correctly when parsing the pass

Chandler Carruth chandlerc at gmail.com
Sat Jan 11 04:06:47 PST 2014


Author: chandlerc
Date: Sat Jan 11 06:06:47 2014
New Revision: 199005

URL: http://llvm.org/viewvc/llvm-project?rev=199005&view=rev
Log:
[PM] Actually nest pass managers correctly when parsing the pass
pipeline string. Add tests that cover this now that we have execution
dumping in the pass managers.

Modified:
    llvm/trunk/test/Other/pass-pipeline-parsing.ll
    llvm/trunk/tools/opt/Passes.cpp

Modified: llvm/trunk/test/Other/pass-pipeline-parsing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/pass-pipeline-parsing.ll?rev=199005&r1=199004&r2=199005&view=diff
==============================================================================
--- llvm/trunk/test/Other/pass-pipeline-parsing.ll (original)
+++ llvm/trunk/test/Other/pass-pipeline-parsing.ll Sat Jan 11 06:06:47 2014
@@ -1,2 +1,18 @@
-; RUN: opt -disable-output -passes=no-op-module,no-op-module %s
-; RUN: opt -disable-output -passes='module(no-op-module,no-op-module)' %s
+; RUN: opt -disable-output -debug-pass-manager \
+; RUN:     -passes=no-op-module,no-op-module %s 2>&1 \
+; RUN:     | FileCheck %s --check-prefix=CHECK-TWO-NOOP-MP
+; CHECK-TWO-NOOP-MP: Starting module pass manager
+; CHECK-TWO-NOOP-MP: Running module pass: NoOpModulePass
+; CHECK-TWO-NOOP-MP: Running module pass: NoOpModulePass
+; CHECK-TWO-NOOP-MP: Finished module pass manager
+
+; RUN: opt -disable-output -debug-pass-manager \
+; RUN:     -passes='module(no-op-module,no-op-module)' %s 2>&1 \
+; RUN:     | FileCheck %s --check-prefix=CHECK-NESTED-TWO-NOOP-MP
+; CHECK-NESTED-TWO-NOOP-MP: Starting module pass manager
+; CHECK-NESTED-TWO-NOOP-MP: Running module pass: ModulePassManager
+; CHECK-NESTED-TWO-NOOP-MP: Starting module pass manager
+; CHECK-NESTED-TWO-NOOP-MP: Running module pass: NoOpModulePass
+; CHECK-NESTED-TWO-NOOP-MP: Running module pass: NoOpModulePass
+; CHECK-NESTED-TWO-NOOP-MP: Finished module pass manager
+; CHECK-NESTED-TWO-NOOP-MP: Finished module pass manager

Modified: llvm/trunk/tools/opt/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Passes.cpp?rev=199005&r1=199004&r2=199005&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Passes.cpp (original)
+++ llvm/trunk/tools/opt/Passes.cpp Sat Jan 11 06:06:47 2014
@@ -51,11 +51,17 @@ static bool parseModulePassPipeline(Modu
   for (;;) {
     // Parse nested pass managers by recursing.
     if (PipelineText.startswith("module(")) {
+      ModulePassManager NestedMPM;
+
+      // Parse the inner pipeline into the nested manager.
       PipelineText = PipelineText.substr(strlen("module("));
-      if (!parseModulePassPipeline(MPM, PipelineText))
+      if (!parseModulePassPipeline(NestedMPM, PipelineText))
         return false;
       assert(!PipelineText.empty() && PipelineText[0] == ')');
       PipelineText = PipelineText.substr(1);
+
+      // Now add the nested manager as a module pass.
+      MPM.addPass(NestedMPM);
     } else {
       // Otherwise try to parse a pass name.
       size_t End = PipelineText.find_first_of(",)");





More information about the llvm-commits mailing list