[llvm-commits] [llvm] r151425 - /llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp

Lang Hames lhames at gmail.com
Fri Feb 24 18:01:00 PST 2012


Author: lhames
Date: Fri Feb 24 20:01:00 2012
New Revision: 151425

URL: http://llvm.org/viewvc/llvm-project?rev=151425&view=rev
Log:
Make the peephole optimizer clear kill flags on a vreg if it's about to add new
uses of the vreg, since the old kills may no longer be valid.  This was causing
-verify-machineinstrs to complain about uses after kills, and could potentially
have been causing subtle register allocation issues, but I haven't come across a
test case yet.

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

Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=151425&r1=151424&r2=151425&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Fri Feb 24 20:01:00 2012
@@ -237,6 +237,10 @@
       if (PHIBBs.count(UseMBB))
         continue;
 
+      // About to add uses of DstReg, clear DstReg's kill flags.
+      if (!Changed)
+        MRI->clearKillFlags(DstReg);
+
       unsigned NewVR = MRI->createVirtualRegister(RC);
       BuildMI(*UseMBB, UseMI, UseMI->getDebugLoc(),
               TII->get(TargetOpcode::COPY), NewVR)





More information about the llvm-commits mailing list