[PATCH] D20606: [PM] Schedule InstCombine after late LICM run, to clean up LCSSA nodes.

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 18:59:43 PDT 2016


mjacob updated this revision to Diff 58375.
mjacob added a comment.

Run much cheaper InstSimplify instead of InstCombine.


http://reviews.llvm.org/D20606

Files:
  lib/Transforms/IPO/PassManagerBuilder.cpp
  test/Other/cleanup-lcssa.ll

Index: test/Other/cleanup-lcssa.ll
===================================================================
--- /dev/null
+++ test/Other/cleanup-lcssa.ll
@@ -0,0 +1,18 @@
+; RUN: opt -S -O3 < %s | FileCheck %s
+
+define i64 @test() {
+entry:
+  br label %loop
+
+loop:
+  %i = phi i64 [ 0, %entry ], [ %inc, %loop ]
+  %inc = add i64 %i, 1
+  %cond = tail call i1 @check()
+  br i1 %cond, label %loop, label %exit
+
+exit:
+  ; CHECK-NOT: lcssa
+  ret i64 %i
+}
+
+declare i1 @check()
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -542,6 +542,9 @@
     // outer loop. LICM pass can help to promote the runtime check out if the
     // checked value is loop invariant.
     MPM.add(createLICMPass());
+
+    // Get rid of LCSSA nodes.
+    MPM.add(createInstructionSimplifierPass());
   }
 
   // After vectorization and unrolling, assume intrinsics may tell us more


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20606.58375.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160525/aae14d46/attachment.bin>


More information about the llvm-commits mailing list