[llvm] [WPD] Change Devirt Cutoff to use DebugCounter (PR #170009)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 29 15:45:05 PST 2025


================
@@ -8,12 +8,12 @@
 ; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -wholeprogramdevirt-read-summary=%S/Inputs/import-vcp-branch-funnel.yaml < %s | FileCheck --check-prefixes=CHECK,VCP,VCP-X86,VCP64,BRANCH-FUNNEL %s
 ; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -wholeprogramdevirt-read-summary=%S/Inputs/import-branch-funnel.yaml < %s | FileCheck --check-prefixes=CHECK,BRANCH-FUNNEL,BRANCH-FUNNEL-NOVCP %s
 
-; Cutoff value is not explicitly set. Expect 3 remark messages.
+; Devirt calls debug counter is not explicitly set. Expect 3 remark messages.
 ; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -pass-remarks=wholeprogramdevirt -wholeprogramdevirt-read-summary=%S/Inputs/import-single-impl.yaml < %s  2>&1 | grep "single-impl" | count 3
-; Cutoff value is set to 1. Expect one remark messages.
-; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -pass-remarks=wholeprogramdevirt -wholeprogramdevirt-cutoff=1  -wholeprogramdevirt-read-summary=%S/Inputs/import-single-impl.yaml < %s  2>&1 | grep "single-impl" | count 1
-; Cutoff value is explicitly set to zero. Expect no remark message.
-; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -pass-remarks=wholeprogramdevirt -wholeprogramdevirt-cutoff=0  -wholeprogramdevirt-read-summary=%S/Inputs/import-single-impl.yaml < %s 2>&1  | FileCheck -implicit-check-not="remark" %s
+; Devirt calls debug counter is set to 1. Expect one remark messages.
----------------
mingmingl-llvm wrote:

nit: setting `-debug-counter=calls-to-devirt=2 -print-debug-counter-queries` devirts the third callsite, and `grep "single-impl"` also gives 1.

Could you tighten up the test to add `-print-debug-counter-queries` and also test that the debug counter output?


`-debug-counter=calls-to-devirt=0 -print-debug-counter-queries` gives the following output.

```
DebugCounter calls-to-devirt=0 execute
remark: <unknown>:0:0: single-impl: devirtualized a call to singleimpl1
DebugCounter calls-to-devirt=1 skip
DebugCounter calls-to-devirt=2 skip

```

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


More information about the llvm-commits mailing list