We should remove the live range from the destination register only if *all* defs
authorBill Wendling <isanbard@gmail.com>
Fri, 25 Jun 2010 20:42:55 +0000 (20:42 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 25 Jun 2010 20:42:55 +0000 (20:42 +0000)
are dead, not just the def of this register. I.e., a register could be dead, but
it's subreg isn't.

Testcase to follow with a subsequent patch.

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

lib/CodeGen/SimpleRegisterCoalescing.cpp

index 620967141785facd8c481ecb6a787a1c57a4f496..5a30ddf5645f138a4cf1eec62123cc1e59d1f974 100644 (file)
@@ -1892,8 +1892,8 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
         if (li_->hasInterval(SrcReg)) {
           LiveInterval &RegInt = li_->getInterval(SrcReg);
           // If def of this move instruction is dead, remove its live range
-          // from the dstination register's live interval.
-          if (MI->registerDefIsDead(DstReg)) {
+          // from the destination register's live interval.
+          if (MI->allDefsAreDead()) {
             if (!ShortenDeadCopySrcLiveRange(RegInt, MI))
               ShortenDeadCopyLiveRange(RegInt, MI);
           } else {