[PATCH] D145218: PHI-def LIveInterval's LaneMask can be calculated by subranges LaneMask when Reg has SubRanges.

michael_zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 01:42:20 PDT 2023


Michael-Zhang-21 updated this revision to Diff 530814.
Michael-Zhang-21 added a comment.

update patch diff again.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145218/new/

https://reviews.llvm.org/D145218

Files:
  llvm/lib/CodeGen/RegisterCoalescer.cpp


Index: llvm/lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -2609,8 +2609,11 @@
           ValueIn = LRQ.valueIn();
           continue;
         }
-        if (LRQ.valueIn() && ValueIn != LRQ.valueIn())
+        if (LRQ.valueIn() && ValueIn != LRQ.valueIn()) {
+          VNI = LRQ.valueIn();
+          TrackReg = SrcReg;
           return std::make_pair(VNI, TrackReg);
+        }
       }
     }
     if (ValueIn == nullptr) {
@@ -2668,6 +2671,16 @@
     // Conservatively assume that all lanes in a PHI are valid.
     LaneBitmask Lanes = SubRangeJoin ? LaneBitmask::getLane(0)
                                      : TRI->getSubRegIndexLaneMask(SubIdx);
+    if (!SubRangeJoin && LIS->getInterval(Reg).hasSubRanges()) {
+      Lanes = LaneBitmask::getNone();
+      for(auto subrangeIt = LIS->getInterval(Reg).subrange_begin();
+          subrangeIt != LIS->getInterval(Reg).subrange_end();
+          subrangeIt++){
+        if (subrangeIt->liveAt(VNI->def)) {
+          Lanes |= subrangeIt->LaneMask;
+        }
+      }
+    }
     V.ValidLanes = V.WriteLanes = Lanes;
   } else {
     DefMI = Indexes->getInstructionFromIndex(VNI->def);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145218.530814.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/9d5dd55e/attachment.bin>


More information about the llvm-commits mailing list