[llvm] r238518 - [MachineCopyPropagation] Fix a bug with undef handling when the value is actualy alive.

Quentin Colombet qcolombet at apple.com
Thu May 28 15:38:40 PDT 2015


Author: qcolombet
Date: Thu May 28 17:38:40 2015
New Revision: 238518

URL: http://llvm.org/viewvc/llvm-project?rev=238518&view=rev
Log:
[MachineCopyPropagation] Fix a bug with undef handling when the value is actualy alive.
Test case will follow.

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

Modified: llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp?rev=238518&r1=238517&r2=238518&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp Thu May 28 17:38:40 2015
@@ -252,11 +252,7 @@ bool MachineCopyPropagation::CopyPropaga
         report_fatal_error("MachineCopyPropagation should be run after"
                            " register allocation!");
 
-      // Treat undef use like defs.
-      // The backends are allowed to do whatever they want with undef value
-      // and we cannot be sure this register will not be rewritten to break
-      // some false dependencies for the hardware for instance.
-      if (MO.isDef() || MO.isUndef()) {
+      if (MO.isDef()) {
         Defs.push_back(Reg);
         continue;
       }
@@ -270,6 +266,14 @@ bool MachineCopyPropagation::CopyPropaga
           MaybeDeadCopies.remove(CI->second);
         }
       }
+      // Treat undef use like defs for copy propagation but not for
+      // dead copy. We would need to do a liveness check to be sure the copy
+      // is dead for undef uses.
+      // The backends are allowed to do whatever they want with undef value
+      // and we cannot be sure this register will not be rewritten to break
+      // some false dependencies for the hardware for instance.
+      if (MO.isUndef())
+        Defs.push_back(Reg);
     }
 
     // The instruction has a register mask operand which means that it clobbers





More information about the llvm-commits mailing list