[llvm] r248460 - Add CFG Simplification pass after Loop Unswitching.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 20:50:17 PDT 2015


Author: mzolotukhin
Date: Wed Sep 23 22:50:17 2015
New Revision: 248460

URL: http://llvm.org/viewvc/llvm-project?rev=248460&view=rev
Log:
Add CFG Simplification pass after Loop Unswitching.

Loop unswitching produces conditional branches with constant condition,
and it's beneficial for later passes to clean this up with simplify-cfg.
We do this after the second invocation of loop-unswitch, but not after
the first one. Not doing so might cause problem for passes like
LoopUnroll, whose estimate of loop body size would be less accurate.

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D13064

Modified:
    llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp

Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=248460&r1=248459&r2=248460&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Wed Sep 23 22:50:17 2015
@@ -260,6 +260,7 @@ void PassManagerBuilder::populateModuleP
   MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1));
   MPM.add(createLICMPass());                  // Hoist loop invariants
   MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3));
+  MPM.add(createCFGSimplificationPass());
   MPM.add(createInstructionCombiningPass());
   MPM.add(createIndVarSimplifyPass());        // Canonicalize indvars
   MPM.add(createLoopIdiomPass());             // Recognize idioms like memset.




More information about the llvm-commits mailing list