[llvm] VirtRegRewriter: Add super register defs for live out undef lanes (PR #112679)

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 01:26:51 PDT 2024


================
@@ -532,6 +535,26 @@ bool VirtRegRewriter::subRegLiveThrough(const MachineInstr &MI,
   return false;
 }
 
+/// Check if we need to maintain liveness for undef subregister lanes that are
+/// live out of a block.
+bool VirtRegRewriter::needLiveOutUndefSubregDef(const LiveInterval &LI,
+                                                const MachineBasicBlock &MBB,
+                                                unsigned SubReg,
+                                                MCPhysReg PhysReg) const {
+  LaneBitmask UndefMask = ~TRI->getSubRegIndexLaneMask(SubReg);
+  for (const LiveInterval::SubRange &SR : LI.subranges()) {
+    LaneBitmask NeedImpDefLanes = UndefMask & SR.LaneMask;
----------------
qcolombet wrote:

Add a comment that SubReg is an undef definition otherwise it is unclear (at least to me) why we would look at the other lanes.

https://github.com/llvm/llvm-project/pull/112679


More information about the llvm-commits mailing list