Files
llvm-project/llvm/test/Analysis/FunctionPropertiesAnalysis/function-properties-analysis.ll
Iñaki V Arrechea ea8554e35b Changed stat passes to count instructions before and after optimizations (#188837)
Created this for instcount and func-properties-analysis to be able to
see the change the optimization pipelines have on stats
2026-04-11 01:47:52 +00:00

64 lines
1.5 KiB
LLVM

; REQUIRES: asserts
; RUN: opt -stats -enable-detailed-function-properties -disable-output -passes=func-properties-stats < %s 2>&1 | FileCheck %s
; CHECK-DAG: 10 func-properties-stats - Number of basic blocks
; CHECK-DAG: 8 func-properties-stats - Number of branch instructions
; CHECK-DAG: 10 func-properties-stats - Number of branch successors
; CHECK-DAG: 2 func-properties-stats - Number of conditional branch instructions
; CHECK-DAG: 6 func-properties-stats - Number of unconditional branch instructions
; CHECK-DAG: 18 func-properties-stats - Number of instructions (of all types)
; CHECK-DAG: 14 func-properties-stats - Number of basic block successors
; CHECK-DAG: 1 func-properties-stats - Number of switch instructions
; CHECK-DAG: 4 func-properties-stats - Number of switch successors
define void @foo(i32 %i, i32 %j, i32 %n) {
entry:
%cmp = icmp slt i32 %i, %j
br i1 %cmp, label %if.then, label %if.end
if.then:
call void @f()
br label %if.end
if.end:
switch i32 %i, label %sw.default [
i32 1, label %sw.bb
i32 2, label %sw.bb1
i32 3, label %sw.bb1
]
sw.bb:
call void @g()
br label %sw.epilog
sw.bb1:
call void @h()
br label %sw.epilog
sw.default:
call void @k()
br label %sw.epilog
sw.epilog:
%cmp2 = icmp sgt i32 %i, %n
br i1 %cmp2, label %if.then3, label %if.else
if.then3:
call void @l()
br label %if.end4
if.else:
call void @m()
br label %if.end4
if.end4:
ret void
}
declare void @f()
declare void @g()
declare void @h()
declare void @k()
declare void @l()
declare void @m()