[llvm] [Docs][CSSPGO] Document llvm.pseudoprobe in LangRef (PR #223211)

chandan singh via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 23:20:46 PDT 2026


https://github.com/chandankds created https://github.com/llvm/llvm-project/pull/223211

llvm.pseudoprobe has existed as an IR intrinsic since the original CSSPGO
instrumentation work, but was only described in Intrinsics.td. Document its
arguments and inaccessiblememonly semantics so pass authors can reason about
its memory effects.

The memory effects exist to discourage transforms that merge probe-carrying
blocks in a way that would break sample-count attribution. They do not
represent a real memory dependence.

Related: https://github.com/llvm/llvm-project/pull/220149
Discussion: https://discourse.llvm.org/t/csspgo-unblocking-pseudo-probe-safe-optimizations/90946

Made with [Cursor](https://cursor.com)

>From fd12cfac1abe468ed45518d10193822d9dbcd6fa Mon Sep 17 00:00:00 2001
From: chandankds <chandankds at gmail.com>
Date: Sun, 13 Sep 2026 06:20:13 +0000
Subject: [PATCH] [Docs][CSSPGO] Document llvm.pseudoprobe in LangRef

llvm.pseudoprobe has existed as an IR intrinsic since the original CSSPGO
instrumentation work, but was only described in Intrinsics.td. Document its
arguments and inaccessiblememonly semantics so pass authors can reason about
its memory effects.
---
 llvm/docs/LangRef.md | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/llvm/docs/LangRef.md b/llvm/docs/LangRef.md
index e5bc44de69f7a8..a5be1e573276ca 100644
--- a/llvm/docs/LangRef.md
+++ b/llvm/docs/LangRef.md
@@ -27115,6 +27115,41 @@ None.
 This intrinsic actually does nothing, but optimizers must assume that it
 has externally observable side effects.
 
+(llvm_pseudoprobe)=
+
+#### '`llvm.pseudoprobe`' Intrinsic
+
+##### Syntax:
+
+```
+declare void @llvm.pseudoprobe(i64 %guid, i64 %index, i32 %attributes, i64 %factor)
+    inaccessiblememonly nounwind willreturn
+```
+
+##### Overview:
+
+The `llvm.pseudoprobe` intrinsic is a placeholder for pseudo-probe-based
+sample profiling (CSSPGO). It identifies the basic block it is placed in so
+that sample counts can later be attributed back to unoptimized IR. It
+performs no operation and is removed during code generation.
+
+##### Arguments:
+
+The first argument is a 64-bit GUID identifying the function that contains
+the probe. The second argument is the probe index within that function. The
+third argument is a bitfield of probe attributes. The fourth argument is a
+distribution factor used when a block is split; `-1` represents a full
+(100%) factor.
+
+##### Semantics:
+
+Like {ref}`llvm.sideeffect <llvm_sideeffect>`, this intrinsic is modeled as
+accessing inaccessible memory so that it is not deleted or moved out of the
+block it probes. It does not actually read or write memory. The memory
+effects exist to discourage transforms that merge or otherwise mix
+probe-carrying blocks in a way that would break sample-count attribution.
+They do not represent a real memory dependence.
+
 #### '`llvm.is.constant.*`' Intrinsic
 
 ##### Syntax:



More information about the llvm-commits mailing list