Skip to content

Commit 6b1e209

Browse files
committed
Try to track NewVR subreg through swap
1 parent 78da9f1 commit 6b1e209

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
@@ -1332,6 +1332,7 @@ void TargetInstrInfo::reassociateOps(
13321332
// recycling RegB because the MachineCombiner's computation of the critical
13331333
// path requires a new register definition rather than an existing one.
13341334
Register NewVR = MRI.createVirtualRegister(RC);
1335+
unsigned SubRegNewVR = 0;
13351336
InstrIdxForVirtReg.insert(std::make_pair(NewVR, 0));
13361337

13371338
auto [NewRootOpc, NewPrevOpc] = getReassociationOpcodes(Pattern, Root, Prev);
@@ -1407,6 +1408,7 @@ void TargetInstrInfo::reassociateOps(
14071408

14081409
if (SwapRootOperands) {
14091410
std::swap(RegA, NewVR);
1411+
std::swap(SubRegA, SubRegNewVR);
14101412
std::swap(KillA, KillNewVR);
14111413
}
14121414

@@ -1420,7 +1422,7 @@ void TargetInstrInfo::reassociateOps(
14201422
if (Idx == RootFirstOpIdx)
14211423
MIB2 = MIB2.addReg(RegA, getKillRegState(KillA), SubRegA);
14221424
else if (Idx == RootSecondOpIdx)
1423-
MIB2 = MIB2.addReg(NewVR, getKillRegState(KillNewVR));
1425+
MIB2 = MIB2.addReg(NewVR, getKillRegState(KillNewVR), SubRegNewVR);
14241426
else
14251427
MIB2 = MIB2.add(MO);
14261428
}

0 commit comments

Comments
 (0)