-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AMDGPU] Handle non-register operands for S_SUB/ADD_U64_PSEUDO #86104
Conversation
This pseudo uses SSrc_b64 so it allows both an immediate or a register, but the lowering crashed on register operands.
@llvm/pr-subscribers-backend-amdgpu Author: Pierre van Houtryve (Pierre-vh) ChangesThis pseudo uses SSrc_b64 so it allows both an immediate or a register, but the lowering crashed on register operands. Full diff: https://github.com/llvm/llvm-project/pull/86104.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 5ccf21f76015de..045095684e845c 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -4858,8 +4858,8 @@ MachineBasicBlock *SITargetLowering::EmitInstrWithCustomInserter(
if (Subtarget->hasScalarAddSub64()) {
unsigned Opc = IsAdd ? AMDGPU::S_ADD_U64 : AMDGPU::S_SUB_U64;
BuildMI(*BB, MI, DL, TII->get(Opc), Dest.getReg())
- .addReg(Src0.getReg())
- .addReg(Src1.getReg());
+ .add(Src0)
+ .add(Src1);
} else {
const SIRegisterInfo *TRI = ST.getRegisterInfo();
const TargetRegisterClass *BoolRC = TRI->getBoolRC();
|
Missing test |
You can test this locally with the following command:git-clang-format --diff 23de3862dce582ce91c1aa914467d982cb1a73b4 ef6356c5b6abf5a01014074e67e8dc52360aa957 -- llvm/lib/Target/AMDGPU/SIISelLowering.cpp View the diff from clang-format here.diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index e91136f66e..5a00d63b9b 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -4857,9 +4857,7 @@ MachineBasicBlock *SITargetLowering::EmitInstrWithCustomInserter(
bool IsAdd = (MI.getOpcode() == AMDGPU::S_ADD_U64_PSEUDO);
if (Subtarget->hasScalarAddSub64()) {
unsigned Opc = IsAdd ? AMDGPU::S_ADD_U64 : AMDGPU::S_SUB_U64;
- BuildMI(*BB, MI, DL, TII->get(Opc), Dest.getReg())
- .add(Src0)
- .add(Src1);
+ BuildMI(*BB, MI, DL, TII->get(Opc), Dest.getReg()).add(Src0).add(Src1);
} else {
const SIRegisterInfo *TRI = ST.getRegisterInfo();
const TargetRegisterClass *BoolRC = TRI->getBoolRC();
|
How can I test ISel pseudo expansion? I didn't find the tests for it |
This somewhat depends on #79553, we currently don't emit those pseudos so it can't be tested. Either that patch needs to add a test for it, or this whole patch should be merged with it |
Crashed on non-register operands? |
Ideally there would be a test that generated the failing pseudo in the first place, but you can also just run finalize-isel on MIR |
Oops, I meant immediate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test that really selected this way would be better
This pseudo uses SSrc_b64 so it allows both an immediate or a register, but the lowering crashed on immediate operands.