[llvm-commits] [llvm] r67331 - /llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp

Bill Wendling isanbard at gmail.com
Thu Mar 19 13:03:38 PDT 2009


Author: void
Date: Thu Mar 19 15:03:38 2009
New Revision: 67331

URL: http://llvm.org/viewvc/llvm-project?rev=67331&view=rev
Log:
--- Merging (from foreign repository) r67304 into '.':
U    lib/CodeGen/PrologEpilogInserter.cpp

Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block.  This is PR3842.

Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp?rev=67331&r1=67330&r2=67331&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/PrologEpilogInserter.cpp Thu Mar 19 15:03:38 2009
@@ -533,11 +533,15 @@
 
         SPAdj += Size;
 
-        MachineBasicBlock::iterator PrevI = prior(I);
+        MachineBasicBlock::iterator PrevI = BB->end();
+        if (I != BB->begin()) PrevI = prior(I);
         TRI.eliminateCallFramePseudoInstr(Fn, *BB, I);
 
         // Visit the instructions created by eliminateCallFramePseudoInstr().
-        I = next(PrevI);
+        if (PrevI == BB->end())
+          I = BB->begin();     // The replaced instr was the first in the block.
+        else
+          I = next(PrevI);
         continue;
       }
 





More information about the llvm-commits mailing list