[llvm] r271602 - [PM] Schedule InstSimplify after late LICM run, to clean up LCSSA nodes.
Manuel Jacob via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 15:14:27 PDT 2016
Author: mjacob
Date: Thu Jun 2 17:14:26 2016
New Revision: 271602
URL: http://llvm.org/viewvc/llvm-project?rev=271602&view=rev
Log:
[PM] Schedule InstSimplify after late LICM run, to clean up LCSSA nodes.
Summary:
The module pass pipeline includes a late LICM run after loop
unrolling. LCSSA is implicitly run as a pass dependency of LICM. However no
cleanup pass was run after this, so the LCSSA nodes ended in the optimized output.
Reviewers: hfinkel, mehdi_amini
Subscribers: majnemer, bruno, mzolotukhin, mehdi_amini, llvm-commits
Differential Revision: http://reviews.llvm.org/D20606
Added:
llvm/trunk/test/Other/cleanup-lcssa.ll
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=271602&r1=271601&r2=271602&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Jun 2 17:14:26 2016
@@ -542,6 +542,9 @@ void PassManagerBuilder::populateModuleP
// 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
Added: llvm/trunk/test/Other/cleanup-lcssa.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/cleanup-lcssa.ll?rev=271602&view=auto
==============================================================================
--- llvm/trunk/test/Other/cleanup-lcssa.ll (added)
+++ llvm/trunk/test/Other/cleanup-lcssa.ll Thu Jun 2 17:14:26 2016
@@ -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()
More information about the llvm-commits
mailing list