[PATCH] Add a callback to FunctionPass to enable skipping execution on a per-function basis

Akira Hatanaka ahatanak at gmail.com
Tue May 26 17:54:51 PDT 2015


================
Comment at: lib/CodeGen/Passes.cpp:295-312
@@ -294,2 +294,20 @@
     }
+
+    // Add the passes after the pass P if there is any.
+    for (SmallVectorImpl<std::pair<AnalysisID, IdentifyingPassPtr> >::iterator
+             I = Impl->InsertedPasses.begin(),
+             E = Impl->InsertedPasses.end();
+         I != E; ++I) {
+      if ((*I).first == PassID) {
+        assert((*I).second.isValid() && "Illegal Pass ID!");
+        Pass *NP;
+        if ((*I).second.isInstance())
+          NP = (*I).second.getInstance();
+        else {
+          NP = Pass::createPass((*I).second.getID());
+          assert(NP && "Pass ID not registered");
+        }
+        addPass(NP, false, false);
+      }
+    }
   } else {
----------------
echristo wrote:
> I'm probably missing something, but why move this code?
Two make-check tests (CodeGen/ARM/ifcvt-branch-weight-bug.ll and ifcvt-branch-weight.ll) fail without this change.

Currently, this code is executed when print-machineinstrs pass has to be added to the pipeline and it is executed only when the overloaded version of addPass that takes AnalysisID is called. Since this patch changes ARMPassConfig::addPreSched2 to use the version of addPass that takes Pass* to add the if-converter pass, I had to move this code to addPass(Pass*) so that it gets executed when either of the overloaded functions is called.

http://reviews.llvm.org/D8717

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list