[PATCH] D145218: Can SubRangeJoin, attribute of JoinVals, be modified by target? Why is this attribute set to false now?

michael_zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 23:21:35 PST 2023


Michael-Zhang-21 created this revision.
Michael-Zhang-21 added reviewers: MatzeB, stoklund.
Herald added subscribers: tpr, hiraditya, qcolombet.
Herald added a project: All.
Michael-Zhang-21 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When doing register coalescing for copys from reg to subreg like this:
%72.ssub_1:vregs = COPY %239:svregs
 If the liverange of %239 conflicts with the liverange of %72, but not for %72.ssub_1.

I have tried set SubRangeJoin to true, this COPY can be coalesced.

So can this attribute be modified by subtarget? Is there any potential problems when set this to true?
Hopeful to get some suggestion. Thanks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145218

Files:
  llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
  llvm/lib/CodeGen/RegisterCoalescer.cpp


Index: llvm/lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -3346,10 +3346,11 @@
   LiveInterval &RHS = LIS->getInterval(CP.getSrcReg());
   LiveInterval &LHS = LIS->getInterval(CP.getDstReg());
   bool TrackSubRegLiveness = MRI->shouldTrackSubRegLiveness(*CP.getNewRC());
+  bool JoinSubRange = MF->getSubtarget().enableJoinSubRange();
   JoinVals RHSVals(RHS, CP.getSrcReg(), CP.getSrcIdx(), LaneBitmask::getNone(),
-                   NewVNInfo, CP, LIS, TRI, false, TrackSubRegLiveness);
+                   NewVNInfo, CP, LIS, TRI, JoinSubRange, TrackSubRegLiveness);
   JoinVals LHSVals(LHS, CP.getDstReg(), CP.getDstIdx(), LaneBitmask::getNone(),
-                   NewVNInfo, CP, LIS, TRI, false, TrackSubRegLiveness);
+                   NewVNInfo, CP, LIS, TRI, JoinSubRange, TrackSubRegLiveness);
 
   LLVM_DEBUG(dbgs() << "\t\tRHS = " << RHS << "\n\t\tLHS = " << LHS << '\n');
 
Index: llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
+++ llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
@@ -297,6 +297,9 @@
   /// possible.
   virtual bool enableSubRegLiveness() const { return false; }
 
+  /// Enable coalescing of subregister.
+  virtual bool enableJoinSubRange() const { return false; }
+
   /// This is called after a .mir file was loaded.
   virtual void mirFileLoaded(MachineFunction &MF) const;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145218.502055.patch
Type: text/x-patch
Size: 1580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230303/488a427c/attachment.bin>


More information about the llvm-commits mailing list