[PATCH] D20725: Make sure function passes are run

Jesper Antonsson via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 02:57:32 PDT 2016


JesperAntonsson created this revision.
JesperAntonsson added a reviewer: chandlerc.
JesperAntonsson added a subscriber: llvm-commits.

This is a correction to [[ https://llvm.org/bugs/show_bug.cgi?id=27509 | bug 27509 ]]. 

The reason for the fix is that optlevel flags might have been be cleared, apparently in order to not rerun the AddOptimizationPasses() function. However, this makes us not run FPasses, which should be wrong.

http://reviews.llvm.org/D20725

Files:
  tools/opt/opt.cpp

Index: tools/opt/opt.cpp
===================================================================
--- tools/opt/opt.cpp
+++ tools/opt/opt.cpp
@@ -615,7 +615,7 @@
   if (OptLevelO3)
     AddOptimizationPasses(Passes, *FPasses, TM.get(), 3, 0);
 
-  if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
+  if (FPasses) {
     FPasses->doInitialization();
     for (Function &F : *M)
       FPasses->run(F);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20725.58757.patch
Type: text/x-patch
Size: 421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/074d374c/attachment.bin>


More information about the llvm-commits mailing list