Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Dec 4, 2025

At least one special case call lowering tries to parse the call
sequence and asserts when it can't find a callseq_end.

Copy link
Contributor Author

arsenm commented Dec 4, 2025

@llvmbot
Copy link
Member

llvmbot commented Dec 4, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

At least one special case call lowering tries to parse the call
sequence and asserts when it can't find a callseq_end.


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

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (+6-1)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index ba80c0695115c..128125d05a3c8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -1412,7 +1412,12 @@ SDValue AMDGPUTargetLowering::lowerUnhandledCall(CallLoweringInfo &CLI,
       InVals.push_back(DAG.getPOISON(Arg.VT));
   }
 
-  return CLI.Chain;
+  // FIXME: Hack because R600 doesn't handle callseq pseudos yet.
+  if (getTargetMachine().getTargetTriple().getArch() == Triple::r600)
+    return CLI.Chain;
+
+  SDValue Chain = DAG.getCALLSEQ_START(CLI.Chain, 0, 0, CLI.DL);
+  return DAG.getCALLSEQ_END(Chain, 0, 0, /*InGlue=*/SDValue(), CLI.DL);
 }
 
 SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI,

@arsenm arsenm marked this pull request as ready for review December 4, 2025 12:46
Base automatically changed from users/arsenm/amdgpu/use-correct-chain-unhandled-call to main December 4, 2025 13:26
Copy link
Contributor

@ro-i ro-i left a comment

Choose a reason for hiding this comment

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

would the call being a tail call matter? (probably not since this is "unhandled call" anyway)

@arsenm
Copy link
Contributor Author

arsenm commented Dec 4, 2025

Tail calls would be opt-in by the lowering, and we don't try to handle musttail today

At least one special case call lowering tries to parse the call
sequence and asserts when it can't find a callseq_end.
@arsenm arsenm force-pushed the users/arsenm/amdgpu/create-dummy-call-sequence-error-function branch from 6d54816 to ce03c68 Compare December 4, 2025 17:11
@arsenm arsenm enabled auto-merge (squash) December 4, 2025 17:14
@arsenm arsenm merged commit 5c659c9 into main Dec 4, 2025
7 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/create-dummy-call-sequence-error-function branch December 4, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants