[llvm] [AMDGPU] Move call site info when SI_CALL_ISEL is replaced (PR #229318)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 23:56:21 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Mian Miftah (mmiftahx)

<details>
<summary>Changes</summary>

The custom inserter replaces SI_CALL_ISEL with SI_CALL and erases the
old instruction without moving its call site info. With
--call-graph-section or -emit-call-site-info, these calls then fail the
"Call site info was not updated!" assertion. Move the info to the new
call, as the Mips delay slot filler does.

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


2 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+1) 
- (added) llvm/test/CodeGen/AMDGPU/call-site-info-si-call.ll (+14) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 126e5f107e8682f..2d20b5a3ed05b03 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -7383,6 +7383,7 @@ SITargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
       MIB.add(MO);
 
     MIB.cloneMemRefs(MI);
+    MF->moveAdditionalCallInfo(&MI, MIB);
     MI.eraseFromParent();
     return BB;
   }
diff --git a/llvm/test/CodeGen/AMDGPU/call-site-info-si-call.ll b/llvm/test/CodeGen/AMDGPU/call-site-info-si-call.ll
new file mode 100644
index 000000000000000..5a40bf88a62a193
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/call-site-info-si-call.ll
@@ -0,0 +1,14 @@
+; RUN: llc -mtriple=amdgpu11.00-amd-amdhsa --call-graph-section \
+; RUN:   -stop-after=finalize-isel < %s | FileCheck %s
+
+; The custom inserter replaces SI_CALL_ISEL with SI_CALL. The call site info
+; has to move to the new instruction.
+
+; CHECK:      callSites:
+; CHECK-NEXT:   - { bb: 0, offset: {{[0-9]+}}, fwdArgRegs: [] }
+; CHECK:      SI_CALL killed
+
+define void @f(ptr inreg %fp) {
+  call void %fp()
+  ret void
+}

``````````

</details>


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


More information about the llvm-commits mailing list