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

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 06:39:33 PDT 2017


JesperAntonsson updated this revision to Diff 109541.
JesperAntonsson added a comment.

Made sure that we don't replace register if the subregister is different.


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,15 @@
     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());
+          if (SubRegB)
+            MO.setSubReg(0);
         }
       }
     }


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


More information about the llvm-commits mailing list