[llvm] [LLVM] InstCount pass implemented when enabling stats (PR #171658)

IƱaki V Arrechea via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 09:46:09 PST 2025


================
@@ -0,0 +1,74 @@
+; RUN: opt -stats -passes=instcount < %s 2>&1 | FileCheck %s --check-prefix=UNOPT
+; RUN: opt -stats -O3 < %s 2>&1 | FileCheck %s --check-prefix=OPT
+
+; --- FIRST RUN (UNOPTIMIZED) ---
+; UNOPT-DAG: 8 instcount - Number of Br insts
+; UNOPT-DAG: 6 instcount - Number of Call insts
+; UNOPT-DAG: 2 instcount - Number of ICmp insts
+; UNOPT-DAG: 1 instcount - Number of Ret insts
+; UNOPT-DAG: 1 instcount - Number of Switch insts
+; UNOPT-DAG: 10 instcount - Number of basic blocks
+; UNOPT-DAG: 1 instcount - Number of non-external functions
+; UNOPT-DAG: 18 instcount - Number of instructions (of all types)
+
+; --- SECOND RUN (OPTIMIZED) ---
+; OPT-DAG: 8 instcount - Number of Br insts
+; OPT-DAG: 6 instcount - Number of Call insts
+; OPT-DAG: 2 instcount - Number of ICmp insts
+; OPT-DAG: 1 instcount - Number of Ret insts
+; OPT-DAG: 1 instcount - Number of Switch insts
+; OPT-DAG: 10 instcount - Number of basic blocks
+; OPT-DAG: 1 instcount - Number of non-external functions
+; OPT-DAG: 18 instcount - Number of instructions (of all types)
+
+
+define dso_local void @foo(i32 noundef %i, i32 noundef %j, i32 noundef %n) {
----------------
InakiVA wrote:

We want to keep the use of a switch so as to in the future be able to count its successors and potentially work on duplicate ones. 
Removed the unnecessary tags for this test case otherwise

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


More information about the llvm-commits mailing list