[llvm] [AMDGPU] Make unsupported libcall legalization a fatal error (PR #214601)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 09:51:52 PDT 2026


================
@@ -4352,6 +4348,13 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
   bool IsSibCall = false;
   MachineFunction &MF = DAG.getMachineFunction();
 
+  if (!CLI.CB) {
+    std::string Msg = "unsupported libcall legalization";
+    if (const auto *G = dyn_cast<ExternalSymbolSDNode>(CLI.Callee))
+      Msg += std::string(" ") + G->getSymbol();
+    report_fatal_error(Twine(Msg), false);
----------------
carlobertolli wrote:

That's what we do today: 
1. Print "error: no libcall available for flog2"
2. Exit with error
3. Generate bad code
```
; %bb.0:
    s_load_dwordx4 s[0:3], s[4:5], 0x0
    v_mov_b32_e32 v0, 0            ; v0 = 0
    s_waitcnt lgkmcnt(0)
    global_store_dwordx2 v0, v[0:1], s[0:1]  ; stores v[0:1] = {0, undef}
    s_endpgm
```

If this is OK, this PR is not needed. I am OK with either case.

https://github.com/llvm/llvm-project/pull/214601


More information about the llvm-commits mailing list