[PATCH] Disable passes on optnone functions

Nick Lewycky nlewycky at google.com
Wed Jan 29 16:01:55 PST 2014


  Please split the patch in two, one for changes to IR-level passes and pass manager (which should land first -- that should help disambiguate when there are pieces that both depend on), one for the codegen changes.

  I'm unsure about the codegen changes here. You're adding a test at the beginning of "runOnMachineFunction" to each machine-level pass. The machine level requires a fixed set of passes to work in a certain way, you can't just disable some passes and expect it to work, the way you can with the IR-level passes.

  The rationale for making the passes individually disable themselves on optnone is because some passes need to ignore optnone -- the always-inliner for example.

  The test probably ought to go into test/Feature/optnone.ll ? Running -O1 and -O2, and opt and llc, it's not really testing the functionattrs pass.

  I've reviewed everything except for lib/CodeGen/* and consider it good to commit. Sorry for the delays in review!


================
Comment at: lib/IR/LegacyPassManager.cpp:1292
@@ -1291,1 +1291,3 @@
     return false;
+  if (F.hasFnAttribute(Attribute::OptimizeNone)) {
+    DEBUG(dbgs() << "Skipping pass '" << getPassName()
----------------
I thought you weren't going to add it to pass managers but to individual passes? This is a pass manager.

================
Comment at: lib/Analysis/LoopPass.cpp:180
@@ -179,1 +179,3 @@
 bool LPPassManager::runOnFunction(Function &F) {
+  if (F.hasFnAttribute(Attribute::OptimizeNone)) {
+    DEBUG(dbgs() << "Skipping pass '" << getPassName()
----------------
This is a pass manager?


http://llvm-reviews.chandlerc.com/D2369



More information about the llvm-commits mailing list