[llvm-branch-commits] [llvm-branch] r89026 - /llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp

Jim Grosbach grosbach at apple.com
Mon Nov 16 17:54:05 PST 2009


Author: grosbach
Date: Mon Nov 16 19:54:05 2009
New Revision: 89026

URL: http://llvm.org/viewvc/llvm-project?rev=89026&view=rev
Log:
merge 89022

Modified:
    llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=89026&r1=89025&r2=89026&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/ARMConstantIslandPass.cpp Mon Nov 16 19:54:05 2009
@@ -1749,21 +1749,23 @@
   // heuristic. FIXME: We can definitely improve it.
   MachineBasicBlock *TBB = 0, *FBB = 0;
   SmallVector<MachineOperand, 4> Cond;
+  SmallVector<MachineOperand, 4> CondPrior;
+  MachineFunction::iterator BBi = BB;
+  MachineFunction::iterator OldPrior = prior(BBi);
 
   // If the block terminator isn't analyzable, don't try to move the block
-  if (TII->AnalyzeBranch(*BB, TBB, FBB, Cond))
-    return NULL;
+  bool B = TII->AnalyzeBranch(*BB, TBB, FBB, Cond);
 
-  // If the block ends in an unconditional branch, move it. Be paranoid
+  // If the block ends in an unconditional branch, move it. The prior block
+  // has to have an analyzable terminator for us to move this one. Be paranoid
   // and make sure we're not trying to move the entry block of the function.
-  if (Cond.empty() && BB != MF.begin()) {
-    MachineFunction::iterator BBi = BB;
-    MachineFunction::iterator OldPrior = prior(BBi);
+  if (!B && Cond.empty() && BB != MF.begin() &&
+      !TII->AnalyzeBranch(*OldPrior, TBB, FBB, CondPrior)) {
     BB->moveAfter(JTBB);
     OldPrior->updateTerminator();
     BB->updateTerminator();
     // Update numbering to account for the block being moved.
-    MF.RenumberBlocks(OldPrior);
+    MF.RenumberBlocks();
     ++NumJTMoved;
     return NULL;
   }





More information about the llvm-branch-commits mailing list