[llvm-commits] [llvm] r83249 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp

Benjamin Kramer benny.kra at googlemail.com
Fri Oct 2 08:59:52 PDT 2009


Author: d0k
Date: Fri Oct  2 10:59:52 2009
New Revision: 83249

URL: http://llvm.org/viewvc/llvm-project?rev=83249&view=rev
Log:
Fix a use-after-free in post-ra-scheduling.

MI->addOperand invalidates references to it's operands, avoid touching
the operand after a new one was added.

Modified:
    llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp

Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=83249&r1=83248&r2=83249&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original)
+++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Fri Oct  2 10:59:52 2009
@@ -884,6 +884,7 @@
 
   // If any subreg of MO is live, then create an imp-def for that
   // subreg and keep MO marked as killed.
+  MO.setIsKill(false);
   bool AllDead = true;
   const unsigned SuperReg = MO.getReg();
   for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg);
@@ -898,7 +899,8 @@
     }
   }
 
-  MO.setIsKill(AllDead);
+  if(AllDead)
+    MO.setIsKill(true);
   return false;
 }
 





More information about the llvm-commits mailing list