Skip to content

Commit c2163dc

Browse files
committed
Try to track NewVR subreg through swap
1 parent 42e0402 commit c2163dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/CodeGen/TargetInstrInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,7 @@ void TargetInstrInfo::reassociateOps(
13531353
// recycling RegB because the MachineCombiner's computation of the critical
13541354
// path requires a new register definition rather than an existing one.
13551355
Register NewVR = MRI.createVirtualRegister(RC);
1356+
unsigned SubRegNewVR = 0;
13561357
InstrIdxForVirtReg.insert(std::make_pair(NewVR, 0));
13571358

13581359
auto [NewRootOpc, NewPrevOpc] = getReassociationOpcodes(Pattern, Root, Prev);
@@ -1428,6 +1429,7 @@ void TargetInstrInfo::reassociateOps(
14281429

14291430
if (SwapRootOperands) {
14301431
std::swap(RegA, NewVR);
1432+
std::swap(SubRegA, SubRegNewVR);
14311433
std::swap(KillA, KillNewVR);
14321434
}
14331435

@@ -1441,7 +1443,7 @@ void TargetInstrInfo::reassociateOps(
14411443
if (Idx == RootFirstOpIdx)
14421444
MIB2 = MIB2.addReg(RegA, getKillRegState(KillA), SubRegA);
14431445
else if (Idx == RootSecondOpIdx)
1444-
MIB2 = MIB2.addReg(NewVR, getKillRegState(KillNewVR));
1446+
MIB2 = MIB2.addReg(NewVR, getKillRegState(KillNewVR), SubRegNewVR);
14451447
else
14461448
MIB2 = MIB2.add(MO);
14471449
}

0 commit comments

Comments
 (0)