[PATCH] D36224: [CodeGen} Correctly replace subregister uses when processing tied operands

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 07:21:45 PDT 2017


JesperAntonsson updated this revision to Diff 109549.
JesperAntonsson retitled this revision from "[CodeGen} Conditionally replace subregister uses when processing tied operands" to "[CodeGen} Correctly replace subregister uses when processing tied operands".
JesperAntonsson edited the summary of this revision.
JesperAntonsson added a comment.

Hmm, sorry, I just realized that the check I introduced in the second patch made it unnecessary to set the subregister conditionally, it could just as well be set unconditionally to zero. So I'm doing this in this update.

This means my patch is now reverting the aforementioned patch 279804 by Matt, except for the tests. However, the tests seem to pass even with my revert. So I'm actually a bit confused here, even though I think my patch is correct. I hope Matt can weigh in on this.


https://reviews.llvm.org/D36224

Files:
  lib/CodeGen/TwoAddressInstructionPass.cpp


Index: lib/CodeGen/TwoAddressInstructionPass.cpp
===================================================================
--- lib/CodeGen/TwoAddressInstructionPass.cpp
+++ lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1579,14 +1579,14 @@
     if (!IsEarlyClobber) {
       // Replace other (un-tied) uses of regB with LastCopiedReg.
       for (MachineOperand &MO : MI->operands()) {
-        if (MO.isReg() && MO.getReg() == RegB &&
+        if (MO.isReg() && MO.getReg() == RegB && MO.getSubReg() == SubRegB &&
             MO.isUse()) {
           if (MO.isKill()) {
             MO.setIsKill(false);
             RemovedKillFlag = true;
           }
           MO.setReg(LastCopiedReg);
-          MO.setSubReg(MO.getSubReg());
+          MO.setSubReg(0);
         }
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36224.109549.patch
Type: text/x-patch
Size: 782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170803/44b2da7c/attachment.bin>


More information about the llvm-commits mailing list