[llvm-commits] [llvm] r144569 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Evan Cheng
evan.cheng at apple.com
Mon Nov 14 13:11:15 PST 2011
Author: evancheng
Date: Mon Nov 14 15:11:15 2011
New Revision: 144569
URL: http://llvm.org/viewvc/llvm-project?rev=144569&view=rev
Log:
Avoid dereferencing off the beginning of lists.
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=144569&r1=144568&r2=144569&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Nov 14 15:11:15 2011
@@ -999,10 +999,8 @@
}
// Move debug info as well.
- if (From != MBB->begin()) {
- while (llvm::prior(From)->isDebugValue())
- --From;
- }
+ while (From != MBB->begin() && llvm::prior(From)->isDebugValue())
+ --From;
// Copies following MI may have been moved as well.
nmi = To;
@@ -1146,9 +1144,8 @@
// Move the old kill above MI, don't forget to move debug info as well.
MachineBasicBlock::iterator InsertPos = mi;
- if (InsertPos != MBB->begin())
- while (llvm::prior(InsertPos)->isDebugValue())
- --InsertPos;
+ while (InsertPos != MBB->begin() && llvm::prior(InsertPos)->isDebugValue())
+ --InsertPos;
MachineBasicBlock::iterator From = KillMI;
MachineBasicBlock::iterator To = llvm::next(From);
while (llvm::prior(From)->isDebugValue())
More information about the llvm-commits
mailing list