[llvm-commits] [llvm] r88917 - /llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp

Jim Grosbach grosbach at apple.com
Mon Nov 16 09:10:56 PST 2009


Author: grosbach
Date: Mon Nov 16 11:10:56 2009
New Revision: 88917

URL: http://llvm.org/viewvc/llvm-project?rev=88917&view=rev
Log:
Analyze has to be before checking the condition, obviously. Properly construct an iterator for prior.

Modified:
    llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=88917&r1=88916&r2=88917&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Mon Nov 16 11:10:56 2009
@@ -1772,13 +1772,15 @@
   int Size = BBSizes[BBI];
   MachineBasicBlock *TBB = 0, *FBB = 0;
   SmallVector<MachineOperand, 4> Cond;
-  // If the block is small and ends in an unconditional branch, move it.
-  if (Size < 50 && Cond.empty()) {
-    // If the block terminator isn't analyzable, don't try to move the block
-    if (TII->AnalyzeBranch(*BB, TBB, FBB, Cond))
-      return NULL;
 
-    MachineFunction::iterator OldPrior = prior(BB);
+  // If the block terminator isn't analyzable, don't try to move the block
+  if (TII->AnalyzeBranch(*BB, TBB, FBB, Cond))
+    return NULL;
+
+  // If the block is small and ends in an unconditional branch, move it.
+  if (Size < 50 && Cond.empty() && BB != MF.begin()) {
+    MachineFunction::iterator BBi = BB;
+    MachineFunction::iterator OldPrior = prior(BBi);
     BB->moveAfter(JTBB);
     OldPrior->updateTerminator();
     BB->updateTerminator();





More information about the llvm-commits mailing list