59 lines · plain
1; RUN: opt %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefixes=CHECK,NOTLOOPENTRIES --implicit-check-not=@llvm.instrprof.increment2; RUN: opt %s -passes=pgo-instr-gen -pgo-instrument-loop-entries -S | FileCheck %s --check-prefixes=CHECK,LOOPENTRIES --implicit-check-not=@llvm.instrprof.increment3; RUN: opt %s -passes=pgo-instr-gen -pgo-instrument-entry -S | FileCheck %s --check-prefixes=CHECK,FUNCTIONENTRY --implicit-check-not=@llvm.instrprof.increment4 5; CHECK: $__llvm_profile_raw_version = comdat any6; CHECK: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat7; CHECK: @__profn_test_simple_for_with_bypass = private constant [27 x i8] c"test_simple_for_with_bypass"8 9define i32 @test_simple_for_with_bypass(i32 %n) {10entry:11; CHECK: entry:12; NOTLOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 1)13; LOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 1)14; FUNCTIONENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 0)15 %mask = and i32 %n, 6553516 %skip = icmp eq i32 %mask, 017 br i1 %skip, label %end, label %for.entry18 19for.entry:20; CHECK: for.entry:21; LOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 2)22 br label %for.cond23 24for.cond:25; CHECK: for.cond:26 %i = phi i32 [ 0, %for.entry ], [ %inc1, %for.inc ]27 %sum = phi i32 [ 1, %for.entry ], [ %inc, %for.inc ]28 %cmp = icmp slt i32 %i, %n29 br i1 %cmp, label %for.body, label %for.end, !prof !130 31for.body:32; CHECK: for.body:33 %inc = add nsw i32 %sum, 134 br label %for.inc35 36for.inc:37; CHECK: for.inc:38; NOTLOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 0)39; LOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 0)40; FUNCTIONENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 1)41 %inc1 = add nsw i32 %i, 142 br label %for.cond43 44for.end:45; CHECK: for.end:46; NOTLOOPENTRIES: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 2)47; FUNCTIONENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_simple_for_with_bypass, i64 {{[0-9]+}}, i32 3, i32 2)48 br label %end49 50end:51; CHECK: end:52 %final_sum = phi i32 [ %sum, %for.end ], [ 0, %entry ]53 ret i32 %final_sum54}55 56; CHECK: declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #057 58!1 = !{!"branch_weights", i32 100000, i32 80}59