File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,13 +190,22 @@ bool isSideEffectFree(MachineInstr *MI) {
190190 // state and is thus not side effect free.
191191 const auto &TRI = static_cast <const AIEBaseRegisterInfo &>(
192192 *MI ->getMF ()->getSubtarget ().getRegisterInfo ());
193- for (const MachineOperand &Def : MI ->defs ()) {
194- if (Def.isReg () && TRI .isFifoPhysReg (Def.getReg ()))
195- return false ;
196- }
197193
198- return !any_of (MI ->defs (), [MBB = MI ->getParent ()](MachineOperand &Def) {
199- return MBB ->isLiveIn (Def.getReg ());
194+ return !any_of (MI ->defs (), [MBB = MI ->getParent (),
195+ &TRI ](MachineOperand &Def) {
196+ Register Reg = Def.getReg ();
197+ unsigned SubReg = Def.getSubReg ();
198+ // Get the lane mask for the def operand: if it has a subreg, use that
199+ // subreg's lane mask; otherwise assume all lanes are defined.
200+ LaneBitmask DefLaneMask =
201+ SubReg ? TRI .getSubRegIndexLaneMask (SubReg) : LaneBitmask::getAll ();
202+ return any_of (MBB ->getLiveIns (),
203+ [Reg, DefLaneMask,
204+ &TRI ](const MachineBasicBlock::RegisterMaskPair &LiveIn) {
205+ // Check if registers overlap AND the lane masks intersect.
206+ return TRI .regsOverlap (Reg, LiveIn.PhysReg ) &&
207+ (DefLaneMask & LiveIn.LaneMask ).any ();
208+ });
200209 });
201210}
202211
You can’t perform that action at this time.
0 commit comments