[llvm] r272770 - Use FPasses in opt exactly when it is initialized.

Patrik Hagglund via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 03:32:00 PDT 2016

Author: patha
Date: Wed Jun 15 05:32:00 2016
New Revision: 272770

URL: http://llvm.org/viewvc/llvm-project?rev=272770&view=rev
Use FPasses in opt exactly when it is initialized.

Previously, there was a discrepancy between the population of function
passes in FPasses, and their invocation. Function passes specified on
the command line, after an optimizaton level was simply discared. This
fix PR27509.

Patch by Jesper Antonsson.

Differential Review: http://reviews.llvm.org/D20725


Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=272770&r1=272769&r2=272770&view=diff
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Wed Jun 15 05:32:00 2016
@@ -615,7 +615,7 @@ int main(int argc, char **argv) {
   if (OptLevelO3)
     AddOptimizationPasses(Passes, *FPasses, TM.get(), 3, 0);
-  if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
+  if (FPasses) {
     for (Function &F : *M)

More information about the llvm-commits mailing list