1 ; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 ; CHECK: @__llvm_profile_name__Z15test_nested_foriii = private constant [22 x i8] c"_Z15test_nested_foriii"
7 define i32 @_Z15test_nested_foriii(i32 %r, i32 %s, i32 %t) {
9 ; CHECK: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__llvm_profile_name__Z15test_nested_foriii, i32 0, i32 0), i64 75296580464, i32 4, i32 3)
13 %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
14 %nested_for_sum.0 = phi i32 [ 1, %entry ], [ %nested_for_sum.1, %for.inc11 ]
15 %cmp = icmp slt i32 %i.0, %r
16 br i1 %cmp, label %for.body, label %for.end13
22 %j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
23 %nested_for_sum.1 = phi i32 [ %nested_for_sum.0, %for.body ], [ %nested_for_sum.2, %for.inc8 ]
24 %cmp2 = icmp slt i32 %j.0, %s
25 br i1 %cmp2, label %for.body3, label %for.end10
31 %k.0 = phi i32 [ 0, %for.body3 ], [ %inc7, %for.inc ]
32 %nested_for_sum.2 = phi i32 [ %nested_for_sum.1, %for.body3 ], [ %inc, %for.inc ]
33 %cmp5 = icmp slt i32 %k.0, %t
34 br i1 %cmp5, label %for.body6, label %for.end
37 %inc = add nsw i32 %nested_for_sum.2, 1
41 ; CHECK: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__llvm_profile_name__Z15test_nested_foriii, i32 0, i32 0), i64 75296580464, i32 4, i32 0)
42 %inc7 = add nsw i32 %k.0, 1
49 ; CHECK: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__llvm_profile_name__Z15test_nested_foriii, i32 0, i32 0), i64 75296580464, i32 4, i32 1)
50 %inc9 = add nsw i32 %j.0, 1
54 ; CHECK: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__llvm_profile_name__Z15test_nested_foriii, i32 0, i32 0), i64 75296580464, i32 4, i32 2)
58 %inc12 = add nsw i32 %i.0, 1
62 ret i32 %nested_for_sum.0