brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · c872c61 Raw
80 lines · plain
1; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY2; RUN: llvm-profdata merge %S/Inputs/loop2.proftext -o %t.profdata3; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE4; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY5; RUN: llvm-profdata merge %S/Inputs/loop2_entry.proftext -o %t.profdata6; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE7target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"8target triple = "x86_64-unknown-linux-gnu"9 10; GEN: $__llvm_profile_raw_version = comdat any11; GEN: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat12; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for"13 14define i32 @test_nested_for(i32 %r, i32 %s) {15entry:16; GEN: entry:17; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 2)18; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 0)19  br label %for.cond.outer20 21for.cond.outer:22; GEN: for.cond.outer:23; GEN-NOT: call void @llvm.instrprof.increment24  %i.0 = phi i32 [ 0, %entry ], [ %inc.2, %for.inc.outer ]25  %sum.0 = phi i32 [ 1, %entry ], [ %sum.1, %for.inc.outer ]26  %cmp = icmp slt i32 %i.0, %r27  br i1 %cmp, label %for.body.outer, label %for.end.outer28; USE: br i1 %cmp, label %for.body.outer, label %for.end.outer29; USE-SAME: !prof ![[BW_FOR_COND_OUTER:[0-9]+]]30 31for.body.outer:32; GEN: for.body.outer:33; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 798733566382720768, i32 3, i32 1)34; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 798733566382720768, i32 3, i32 2)35  br label %for.cond.inner36 37for.cond.inner:38; GEN: for.cond.inner:39; GEN-NOT: call void @llvm.instrprof.increment40  %j.0 = phi i32 [ 0, %for.body.outer ], [ %inc.1, %for.inc.inner ]41  %sum.1 = phi i32 [ %sum.0, %for.body.outer ], [ %inc, %for.inc.inner ]42  %cmp2 = icmp slt i32 %j.0, %s43  br i1 %cmp2, label %for.body.inner, label %for.end.inner44; USE: br i1 %cmp2, label %for.body.inner, label %for.end.inner45; USE-SAME: !prof ![[BW_FOR_COND_INNER:[0-9]+]]46 47for.body.inner:48; GEN: for.body.inner:49; GEN-NOT: call void @llvm.instrprof.increment50  %inc = add nsw i32 %sum.1, 151  br label %for.inc.inner52 53for.inc.inner:54; GEN: for.inc.inner:55; NOTENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 0)56; ENTRY: call void @llvm.instrprof.increment(ptr @__profn_test_nested_for, i64 {{[0-9]+}}, i32 3, i32 1)57  %inc.1 = add nsw i32 %j.0, 158  br label %for.cond.inner59 60for.end.inner:61; GEN: for.end.inner:62  br label %for.inc.outer63 64for.inc.outer:65; GEN: for.inc.outer:66; GEN-NOT: call void @llvm.instrprof.increment67  %inc.2 = add nsw i32 %i.0, 168  br label %for.cond.outer69 70for.end.outer:71; GEN: for.end.outer:72; GEN-NOT: call void @llvm.instrprof.increment73; GEN: ret i3274  ret i32 %sum.075}76 77; USE-DAG: ![[BW_FOR_COND_OUTER]] = !{!"branch_weights", i32 10, i32 6}78; USE-DAG: ![[BW_FOR_COND_INNER]] = !{!"branch_weights", i32 33, i32 10}79 80