[PATCH] D30468: Simplify the CFG after loop pass cleanup.

Filipe Cabecinhas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 11:38:10 PST 2017


filcab created this revision.
Herald added a subscriber: mehdi_amini.

Otherwise we might end up with some empty basic blocks or
single-entry-single-exit basic blocks.

This fixes PR32085


https://reviews.llvm.org/D30468

Files:
  lib/Transforms/IPO/PassManagerBuilder.cpp
  test/Other/pass-pipelines.ll


Index: test/Other/pass-pipelines.ll
===================================================================
--- test/Other/pass-pipelines.ll
+++ test/Other/pass-pipelines.ll
@@ -85,6 +85,7 @@
 ; CHECK-O2: FunctionPass Manager
 ; CHECK-O2: Loop Pass Manager
 ; CHECK-O2-NEXT: Loop Sink
+; CHECK-O2: Simplify the CFG
 ; CHECK-O2-NOT: Manager
 ;
 ; FIXME: There really shouldn't be another pass manager, especially one that
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -661,6 +661,11 @@
   MPM.add(createLoopSinkPass());
   // Get rid of LCSSA nodes.
   MPM.add(createInstructionSimplifierPass());
+
+  // LoopSink (and other loop passes since the last simplifyCFG) might have
+  // resulted in single-entry-single-exit or empty blocks. Clean up the CFG.
+  MPM.add(createCFGSimplificationPass());
+
   addExtensionsToPM(EP_OptimizerLast, MPM);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30468.90065.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170228/95a552e8/attachment.bin>


More information about the llvm-commits mailing list