[llvm] [TwoAddressInstruction] Update LiveIntervals after INSERT_SUBREG with undef read (PR #66211)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 07:05:54 PDT 2023
================
@@ -1868,12 +1868,16 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &Func) {
// %reg.subidx.
LaneBitmask LaneMask =
TRI->getSubRegIndexLaneMask(mi->getOperand(0).getSubReg());
- SlotIndex Idx = LIS->getInstructionIndex(*mi);
+ SlotIndex Idx = LIS->getInstructionIndex(*mi).getRegSlot();
for (auto &S : LI.subranges()) {
if ((S.LaneMask & LaneMask).none()) {
- LiveRange::iterator UseSeg = S.FindSegmentContaining(Idx);
- LiveRange::iterator DefSeg = std::next(UseSeg);
- S.MergeValueNumberInto(DefSeg->valno, UseSeg->valno);
+ LiveRange::iterator DefSeg = S.FindSegmentContaining(Idx);
+ if (mi->getOperand(0).isUndef()) {
+ S.removeValNo(DefSeg->valno);
----------------
jayfoad wrote:
TBH I am pretty nervous about all this low level fiddling around with live ranges. I would be much happier if there was some higher level API I could use to do this kind of update.
https://github.com/llvm/llvm-project/pull/66211
More information about the llvm-commits
mailing list