Don't access MO reference after invalidating operand list.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 14 May 2012 21:30:58 +0000 (21:30 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 14 May 2012 21:30:58 +0000 (21:30 +0000)
This should unbreak llvm-x86_64-linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156778 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegAllocFast.cpp

index 15485b13dadc15f6ab1ed2ece7114b9ee31576d8..b38322215147e4e6ffb66a37acc2c861303858d7 100644 (file)
@@ -659,9 +659,10 @@ RAFast::reloadVirtReg(MachineInstr *MI, unsigned OpNum,
 // Return true if the operand kills its register.
 bool RAFast::setPhysReg(MachineInstr *MI, unsigned OpNum, unsigned PhysReg) {
   MachineOperand &MO = MI->getOperand(OpNum);
+  bool Dead = MO.isDead();
   if (!MO.getSubReg()) {
     MO.setReg(PhysReg);
-    return MO.isKill() || MO.isDead();
+    return MO.isKill() || Dead;
   }
 
   // Handle subregister index.
@@ -680,7 +681,7 @@ bool RAFast::setPhysReg(MachineInstr *MI, unsigned OpNum, unsigned PhysReg) {
   if (MO.isDef() && MO.isUndef())
     MI->addRegisterDefined(PhysReg, TRI);
 
-  return MO.isDead();
+  return Dead;
 }
 
 // Handle special instruction operand like early clobbers and tied ops when