Skip to content

Conversation

@phoebewang
Copy link
Contributor

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 #90954

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
@phoebewang phoebewang requested review from RKSimon and fhahn May 6, 2024 13:48
@llvmbot
Copy link
Member

llvmbot commented May 6, 2024

@llvm/pr-subscribers-backend-x86

Author: Phoebe Wang (phoebewang)

Changes

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 #90954


Full diff: https://github.com/llvm/llvm-project/pull/91207.diff

1 Files Affected:

  • (modified) llvm/lib/Target/X86/X86LowerTileCopy.cpp (+2-2)
diff --git a/llvm/lib/Target/X86/X86LowerTileCopy.cpp b/llvm/lib/Target/X86/X86LowerTileCopy.cpp index fd05e16ac1ceff..60c024556ff13f 100644 --- a/llvm/lib/Target/X86/X86LowerTileCopy.cpp +++ b/llvm/lib/Target/X86/X86LowerTileCopy.cpp @@ -146,7 +146,7 @@ bool X86LowerTileCopy::runOnMachineFunction(MachineFunction &MF) { addFrameReference(BuildMI(MBB, MI, DL, TII->get(Opc)), TileSS) .addReg(SrcReg, getKillRegState(SrcMO.isKill())); MachineOperand &MO = NewMI->getOperand(2); - MO.setReg(GR64Cand); + MO.setReg(GR64Cand ? GR64Cand : X86::RAX); MO.setIsKill(true); // tileloadd (%sp, %idx), %tmm Opc = GET_EGPR_IF_ENABLED(X86::TILELOADD); @@ -157,7 +157,7 @@ bool X86LowerTileCopy::runOnMachineFunction(MachineFunction &MF) { // restore %rax // mov (%sp) %rax addFrameReference( - BuildMI(MBB, MI, DL, TII->get(X86::MOV64rm), GR64Cand), StrideSS); + BuildMI(MBB, MI, DL, TII->get(X86::MOV64rm), X86::RAX), StrideSS); } MI.eraseFromParent(); Changed = true; 
@phoebewang
Copy link
Contributor Author

Ping?

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a fix, would be nice to get a crash test added though if you can.

@phoebewang
Copy link
Contributor Author

LGTM as a fix, would be nice to get a crash test added though if you can.

Done. The LLVM bugpoint cannot work for AMX tests, finally reduced it with the help of #92280.

@phoebewang phoebewang merged commit b576a6b into llvm:main May 15, 2024
@phoebewang phoebewang deleted the AMX branch May 15, 2024 15:15
phoebewang added a commit to phoebewang/llvm-project that referenced this pull request May 16, 2024
phoebewang added a commit that referenced this pull request Oct 3, 2025
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
MixedMatched pushed a commit to MixedMatched/llvm-project that referenced this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants