[llvm] Add reference of llvm.pseudoprobe in LangRef.md (PR #223065)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 16:50:53 PDT 2026


================
@@ -27083,42 +27083,60 @@ declare void @llvm.pseudoprobe(i64 <guid>, i64 <index>, i32 <attributes>, i64 <f
 
 ##### Overview:
 
-The `llvm.pseudoprobe` intrinsic is a placeholder for the block that
-contains it. It is emitted for sample-based profile-guided optimization, so
-that samples collected from an optimized binary can be attributed back to a
-point in the original program. It performs no operation.
+The `llvm.pseudoprobe` intrinsic identifies a basic block of the function's
+pre-optimized CFG, so that samples collected from an optimized binary can be
+attributed back to the program as it was before optimization ran. It is emitted
+for sample-based profile-guided optimization.
 
-Like `llvm.sideeffect`, optimizers treat it as having opaque side effects, so
-that it is neither deleted nor moved out of the block it probes. A probe that
-disappears or moves breaks the correspondence between the collected profile
-and the code it describes.
+Probes are inserted in the first pass of the pipeline and indexed by walking
+the function rather than by source location, so a probe keeps naming the same
+original block however that block is later inlined, cloned or rearranged. It is
+a pseudo intrinsic: it performs no operation and lowers to no machine
+instruction, only to a label recorded in the `.pseudo_probe` section.
----------------
MatzeB wrote:

Like the explanation; should probably say "... walking a function ..." (otherwise I'm not exactly sure what exactly identity of "the" function is)...
contrasting against source location feels unnecessary to me here (but also not strongly opposed if you prefer to keep it). Either way I like the second half explanation that it keeps naming the original block regardless of inlining, cloning, rearranging...

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


More information about the llvm-commits mailing list