Skip to content

Commit 609666e

Browse files
committed
[X86][AMX] Fix a bug after llvm#83628
We need to check if `GR64Cand` a valid register before using it. Test is not needed since it's covered in llvm-test-suite. Fixes llvm#90954
1 parent d71771d commit 609666e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/X86/X86LowerTileCopy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ bool X86LowerTileCopy::runOnMachineFunction(MachineFunction &MF) {
146146
addFrameReference(BuildMI(MBB, MI, DL, TII->get(Opc)), TileSS)
147147
.addReg(SrcReg, getKillRegState(SrcMO.isKill()));
148148
MachineOperand &MO = NewMI->getOperand(2);
149-
MO.setReg(GR64Cand);
149+
MO.setReg(GR64Cand ? GR64Cand : X86::RAX);
150150
MO.setIsKill(true);
151151
// tileloadd (%sp, %idx), %tmm
152152
Opc = GET_EGPR_IF_ENABLED(X86::TILELOADD);
@@ -157,7 +157,7 @@ bool X86LowerTileCopy::runOnMachineFunction(MachineFunction &MF) {
157157
// restore %rax
158158
// mov (%sp) %rax
159159
addFrameReference(
160-
BuildMI(MBB, MI, DL, TII->get(X86::MOV64rm), GR64Cand), StrideSS);
160+
BuildMI(MBB, MI, DL, TII->get(X86::MOV64rm), X86::RAX), StrideSS);
161161
}
162162
MI.eraseFromParent();
163163
Changed = true;

0 commit comments

Comments
 (0)