[PATCH] D13064: Add CFG Simplification pass after Loop Unswitching.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 12:11:17 PDT 2015


mzolotukhin created this revision.
mzolotukhin added reviewers: chandlerc, hfinkel.
mzolotukhin added a subscriber: llvm-commits.

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.

http://reviews.llvm.org/D13064

Files:
  lib/Transforms/IPO/PassManagerBuilder.cpp

Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -260,6 +260,7 @@
   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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13064.35401.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150922/2ebcd801/attachment.bin>


More information about the llvm-commits mailing list