[llvm] [PseudoProbe] Preserve probe identity for inlined nodebug calls (PR #219079)

Wei Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 10:15:26 PDT 2026


================
@@ -2013,7 +2013,14 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
     if (isa<PseudoProbeInst>(I))
       return;
 
-    I.setDebugLoc(TheCallDL);
+    DebugLoc DL = TheCallDL;
+    // A call receiving the outer callsite's fallback location has no usable
+    // callsite probe of its own. Do not let it inherit the outer call's probe
+    // discriminator.
+    if (isa<CallBase>(I) && DL &&
+        DILocation::isPseudoProbeDiscriminator(DL->getDiscriminator()))
+      DL = DL->cloneWithDiscriminator(0);
----------------
apolloww wrote:

This also drops the DWARF based discriminator. Since the intention here is to drop probe bits only but use caller's debugloc, a better way to do is

https://github.com/llvm/llvm-project/blob/e2e8caf51f5029df79968db391e630533fd13c19/llvm/lib/Transforms/IPO/SampleProfile.cpp#L2129-L2135

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


More information about the llvm-commits mailing list