Ensure all defs referring to a virtual register are marked dead by addRegisterDead().
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 5 Apr 2011 16:53:50 +0000 (16:53 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 5 Apr 2011 16:53:50 +0000 (16:53 +0000)
There can be multiple defs for a single virtual register when they are defining
sub-registers.

The missing <dead> flag was stopping the inline spiller from eliminating dead
code after rematerialization.

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

lib/CodeGen/MachineInstr.cpp
test/CodeGen/X86/coalescer-cross.ll

index dce05d3e3f47d096a2a1f4396ea9ddc2f7e28647..0d137ebba230df90161987605c84d41488902dc5 100644 (file)
@@ -1543,13 +1543,8 @@ bool MachineInstr::addRegisterDead(unsigned IncomingReg,
       continue;
 
     if (Reg == IncomingReg) {
-      if (!Found) {
-        if (MO.isDead())
-          // The register is already marked dead.
-          return true;
-        MO.setIsDead();
-        Found = true;
-      }
+      MO.setIsDead();
+      Found = true;
     } else if (hasAliases && MO.isDead() &&
                TargetRegisterInfo::isPhysicalRegister(Reg)) {
       // There exists a super-register that's marked dead.
index 7d6f399930fd4554c20bf424ab175cc4220db723..976db6479e090a982d3ea4af265f8c730b226a47 100644 (file)
@@ -1,6 +1,10 @@
-; RUN: llc < %s -mtriple=i386-apple-darwin10 | not grep movaps
+; RUN: llc < %s -mtriple=i386-apple-darwin10 | FileCheck %s
+; RUN: llc < %s -mtriple=i386-apple-darwin10 -regalloc=basic | FileCheck %s
 ; rdar://6509240
 
+; CHECK: os_clock
+; CHECK-NOT: movaps
+
        type { %struct.TValue }         ; type %0
        type { %struct.L_Umaxalign, i32, %struct.Node* }                ; type %1
        %struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.TValue*, i32*, i32, i32 }