1 ; RUN: opt < %s -instrprof -S -o - -do-counter-promotion=1 -skip-ret-exit-block=1 | FileCheck %s --check-prefixes=CHECK,SKIP
2 ; RUN: opt < %s -instrprof -S -o - -do-counter-promotion=1 -skip-ret-exit-block=0 | FileCheck %s --check-prefixes=CHECK,NOTSKIP
4 $__llvm_profile_raw_version = comdat any
6 @bar = dso_local local_unnamed_addr global i32 0, align 4
7 @__llvm_profile_raw_version = constant i64 72057594037927941, comdat
8 @__profn_foo = private constant [3 x i8] c"foo"
10 define dso_local void @foo(i32 %n) {
12 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 29212902728, i32 2, i32 1)
16 %i.0 = phi i32 [ 0, %entry ], [ %inc, %if.end ]
17 %cmp = icmp slt i32 %i.0, %n
18 %0 = load i32, i32* @bar, align 4
19 %tobool.not = icmp eq i32 %0, 0
20 %or.cond = and i1 %cmp, %tobool.not
21 br i1 %or.cond, label %if.end, label %cleanup
24 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 29212902728, i32 2, i32 0)
25 call void (...) @bar2()
26 %inc = add nuw nsw i32 %i.0, 1
31 ; SKIP-NOT: %pgocount.promoted
32 ; NOTSKIP: %pgocount.promoted
36 declare dso_local void @bar2(...)
38 declare void @llvm.instrprof.increment(i8*, i64, i32, i32)