Skip to content

Commit a485984

Browse files
committedJun 2, 2016
[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 llvm-svn: 271602
1 parent 6dfdbf1 commit a485984

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

‎llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ void PassManagerBuilder::populateModulePassManager(
542542
// outer loop. LICM pass can help to promote the runtime check out if the
543543
// checked value is loop invariant.
544544
MPM.add(createLICMPass());
545+
546+
// Get rid of LCSSA nodes.
547+
MPM.add(createInstructionSimplifierPass());
545548
}
546549

547550
// After vectorization and unrolling, assume intrinsics may tell us more

‎llvm/test/Other/cleanup-lcssa.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; RUN: opt -S -O3 < %s | FileCheck %s
2+
3+
define i64 @test() {
4+
entry:
5+
br label %loop
6+
7+
loop:
8+
%i = phi i64 [ 0, %entry ], [ %inc, %loop ]
9+
%inc = add i64 %i, 1
10+
%cond = tail call i1 @check()
11+
br i1 %cond, label %loop, label %exit
12+
13+
exit:
14+
; CHECK-NOT: lcssa
15+
ret i64 %i
16+
}
17+
18+
declare i1 @check()

0 commit comments

Comments
 (0)
Please sign in to comment.