[llvm] Amdgpu si call isel callinfo pr clean (PR #192194)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 23:47:09 PDT 2026


https://github.com/StevenYangCC created https://github.com/llvm/llvm-project/pull/192194

[AMDGPU] Add SI_CALL_ISEL callsite info regression
    
    Cover the SI_CALL_ISEL lowering path with emit-call-site-info enabled so call metadata regressions are caught before FinalizeISel erases the pseudo.


>From 616cbb2b2891ba7baef3ae179c2e38a7e30b9260 Mon Sep 17 00:00:00 2001
From: "chengcang.yang" <yangchengcang at gmail.com>
Date: Wed, 15 Apr 2026 14:27:41 +0800
Subject: [PATCH 1/2] [AMDGPU] Preserve call info when lowering SI_CALL_ISEL

Keep additional call metadata attached when the custom inserter rewrites SI_CALL_ISEL into SI_CALL so later analyses still see the original direct-call information.
---
 llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 6750dfcbaac62..b37950e32ffb3 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -6847,6 +6847,8 @@ SITargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
       MIB.add(MO);
 
     MIB.cloneMemRefs(MI);
+    if (MI.shouldUpdateAdditionalCallInfo())
+      MF->moveAdditionalCallInfo(&MI, MIB.getInstr());
     MI.eraseFromParent();
     return BB;
   }

>From c137c01ce2786d181c279b30c1afda837c087b5a Mon Sep 17 00:00:00 2001
From: "chengcang.yang" <yangchengcang at gmail.com>
Date: Wed, 15 Apr 2026 14:27:41 +0800
Subject: [PATCH 2/2] [AMDGPU] Add SI_CALL_ISEL callsite info regression

Cover the SI_CALL_ISEL lowering path with emit-call-site-info enabled so call metadata regressions are caught before FinalizeISel erases the pseudo.
---
 .../CodeGen/AMDGPU/si-call-isel-callsite-info.ll  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 llvm/test/CodeGen/AMDGPU/si-call-isel-callsite-info.ll

diff --git a/llvm/test/CodeGen/AMDGPU/si-call-isel-callsite-info.ll b/llvm/test/CodeGen/AMDGPU/si-call-isel-callsite-info.ll
new file mode 100644
index 0000000000000..a392b28ad6084
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/si-call-isel-callsite-info.ll
@@ -0,0 +1,15 @@
+; RUN: llc -emit-call-site-info -stop-after=dead-mi-elimination -mtriple=amdgcn-- -mcpu=gfx900 -o - %s | FileCheck %s
+
+; CHECK-LABEL: name:            basic_call
+; CHECK: $sgpr30_sgpr31 = SI_CALL {{.*}}, @foo, csr_amdgpu
+
+define i32 @basic_call(i32 %src) #0 {
+  %token = call token @llvm.experimental.convergence.entry()
+  %result = call i32 @foo(i32 %src) [ "convergencectrl"(token %token) ]
+  ret i32 %result
+}
+
+declare i32 @foo(i32) #0
+declare token @llvm.experimental.convergence.entry()
+
+attributes #0 = { convergent nounwind readnone }



More information about the llvm-commits mailing list