Skip to content

Commit 8804293

Browse files
author
Evan Cheng
committed
Find loop back edges only after empty blocks are eliminated.
llvm-svn: 61752
1 parent 84434a6 commit 8804293

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,13 @@ void CodeGenPrepare::findLoopBackEdges(Function &F) {
125125
bool CodeGenPrepare::runOnFunction(Function &F) {
126126
bool EverMadeChange = false;
127127

128-
findLoopBackEdges(F);
129-
130128
// First pass, eliminate blocks that contain only PHI nodes and an
131129
// unconditional branch.
132130
EverMadeChange |= EliminateMostlyEmptyBlocks(F);
133131

132+
// Now find loop back edges.
133+
findLoopBackEdges(F);
134+
134135
bool MadeChange = true;
135136
while (MadeChange) {
136137
MadeChange = false;

llvm/test/CodeGen/X86/remat-mov0.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 1
1+
; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 2
22

33
%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
44
%struct.ImgT = type { i8, i8*, i8*, %struct.FILE*, i32, i32, i32, i32, i8*, double*, float*, float*, float*, i32*, double, double, i32*, double*, i32*, i32* }

0 commit comments

Comments
 (0)