[llvm-branch-commits] [llvm-branch] r100805 - in /llvm/branches/Apple/Morbo: include/llvm/CodeGen/MachineInstr.h lib/CodeGen/MachineInstr.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2010-04-08-CoalescerBug.ll

Evan Cheng evan.cheng at apple.com
Thu Apr 8 13:08:56 PDT 2010


Author: evancheng
Date: Thu Apr  8 15:08:56 2010
New Revision: 100805

URL: http://llvm.org/viewvc/llvm-project?rev=100805&view=rev
Log:
Merge 100804.

Added:
    llvm/branches/Apple/Morbo/test/CodeGen/X86/2010-04-08-CoalescerBug.ll
      - copied unchanged from r100804, llvm/trunk/test/CodeGen/X86/2010-04-08-CoalescerBug.ll
Modified:
    llvm/branches/Apple/Morbo/include/llvm/CodeGen/MachineInstr.h
    llvm/branches/Apple/Morbo/lib/CodeGen/MachineInstr.cpp
    llvm/branches/Apple/Morbo/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/branches/Apple/Morbo/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/include/llvm/CodeGen/MachineInstr.h?rev=100805&r1=100804&r2=100805&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/branches/Apple/Morbo/include/llvm/CodeGen/MachineInstr.h Thu Apr  8 15:08:56 2010
@@ -357,6 +357,10 @@
   /// return 0.
   unsigned isConstantValuePHI() const;
 
+  /// allDefsAreDead - Return true if all the defs of this instruction are dead.
+  ///
+  bool allDefsAreDead() const;
+
   //
   // Debugging support
   //

Modified: llvm/branches/Apple/Morbo/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/CodeGen/MachineInstr.cpp?rev=100805&r1=100804&r2=100805&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/CodeGen/MachineInstr.cpp Thu Apr  8 15:08:56 2010
@@ -1123,6 +1123,19 @@
   return Reg;
 }
 
+/// allDefsAreDead - Return true if all the defs of this instruction are dead.
+///
+bool MachineInstr::allDefsAreDead() const {
+  for (unsigned i = 0, e = getNumOperands(); i < e; ++i) {
+    const MachineOperand &MO = getOperand(i);
+    if (!MO.isReg() || MO.isUse())
+      continue;
+    if (!MO.isDead())
+      return false;
+  }
+  return true;
+}
+
 void MachineInstr::dump() const {
   dbgs() << "  " << *this;
 }

Modified: llvm/branches/Apple/Morbo/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=100805&r1=100804&r2=100805&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Apr  8 15:08:56 2010
@@ -2744,7 +2744,7 @@
             // delete them later.
             DoDelete = false;
         }
-        if (MI->registerDefIsDead(DstReg)) {
+        if (MI->allDefsAreDead()) {
           LiveInterval &li = li_->getInterval(DstReg);
           if (!ShortenDeadCopySrcLiveRange(li, MI))
             ShortenDeadCopyLiveRange(li, MI);





More information about the llvm-branch-commits mailing list