Find loop back edges only after empty blocks are eliminated.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 5 Jan 2009 21:17:27 +0000 (21:17 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 5 Jan 2009 21:17:27 +0000 (21:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61752 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CodeGenPrepare.cpp
test/CodeGen/X86/remat-mov0.ll

index ff9d32c316d69df06c720c9e7402da882d09fb49..125b0760954d78897f322ef11aa4f3c2063d481a 100644 (file)
@@ -125,12 +125,13 @@ void CodeGenPrepare::findLoopBackEdges(Function &F) {
 bool CodeGenPrepare::runOnFunction(Function &F) {
   bool EverMadeChange = false;
 
-  findLoopBackEdges(F);
-
   // First pass, eliminate blocks that contain only PHI nodes and an
   // unconditional branch.
   EverMadeChange |= EliminateMostlyEmptyBlocks(F);
 
+  // Now find loop back edges.
+  findLoopBackEdges(F);
+
   bool MadeChange = true;
   while (MadeChange) {
     MadeChange = false;
index a50c8f3fa9cfc54feb319f7508a3222631a3fa62..360628cb6aeb199bc28e8a696f4d114854d8e104 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 1
+; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 2
 
        %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 }
        %struct.ImgT = type { i8, i8*, i8*, %struct.FILE*, i32, i32, i32, i32, i8*, double*, float*, float*, float*, i32*, double, double, i32*, double*, i32*, i32* }