[llvm] [profcheck] Add indirect call metadata (PR #154657)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 21:04:24 PDT 2025


================
@@ -0,0 +1,31 @@
+; Check insertion and verification of indirect calls
+; RUN: split-file %s %t
+; RUN: opt -passes=prof-inject %t/inject.ll -S -o - | FileCheck %t/inject.ll
+; RUN: opt -passes=prof-verify %t/verify-ok.ll -S -o - | FileCheck %t/verify-ok.ll
+; RUN: not opt -passes=prof-verify %t/verify-bad.ll -S -o - 2>&1 | FileCheck %t/verify-bad.ll
+
+;--- inject.ll
+define void @foo(ptr %f) {
+  call void %f()
+  ret void
+}
+
+; CHECK: call void %f(), !prof
+
+;--- verify-ok.ll
+define void @foo(ptr %f) !prof !0 {
+  call void %f(), !prof !1
+  ret void
+}
+!0 = !{!"function_entry_count", i64 10}
+!1 = !{!"VP", i32 2, i64 100, i64 123, i64 50, i64 456, i64 50}
+
+; CHECK: call void %f(), !prof !1
----------------
mingmingl-llvm wrote:

nit: same here. It'd be great to check the `!prof !1` remains the same as `!{!"VP", i32 2, i64 100, i64 123, i64 50, i64 456, i64 50}` and not overridden by the bogus value.

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


More information about the llvm-commits mailing list