50 lines · plain
1; Supplement instr profile suppl-profile.proftext with sample profile2; sample-profile.proftext.3; For hot functions:4; RUN: llvm-profdata merge -instr -suppl-min-size-threshold=0 \5; RUN: -supplement-instr-with-sample=%p/Inputs/sample-profile-hot.proftext \6; RUN: %S/Inputs/suppl-profile.proftext -o %t.profdata7; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=HOT8; For warm functions:9; RUN: llvm-profdata merge -instr -suppl-min-size-threshold=0 \10; RUN: -supplement-instr-with-sample=%p/Inputs/sample-profile-warm.proftext \11; RUN: %S/Inputs/suppl-profile.proftext -o %t1.profdata12; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t1.profdata -S | FileCheck %s --check-prefix=WARM13 14target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"15target triple = "x86_64-unknown-linux-gnu"16 17; Check test_simple_for has proper hot/cold attribute and no profile counts.18; HOT: @test_simple_for(i32 %n)19; HOT-SAME: #[[ATTRIBTE:[0-9]*]]20; HOT-NOT: !prof !{{.*}}21; HOT-SAME: {22; HOT: attributes #[[ATTRIBTE]] = { hot }23; WARM: @test_simple_for(i32 %n)24; WARM-NOT: #{{.*}}25; WARM-NOT: !prof !{{.*}}26; WARM-SAME: {27define i32 @test_simple_for(i32 %n) #0 {28entry:29 br label %for.cond30 31for.cond:32 %i = phi i32 [ 0, %entry ], [ %inc1, %for.inc ]33 %sum = phi i32 [ 1, %entry ], [ %inc, %for.inc ]34 %cmp = icmp slt i32 %i, %n35 br i1 %cmp, label %for.body, label %for.end36 37for.body:38 %inc = add nsw i32 %sum, 139 br label %for.inc40 41for.inc:42 %inc1 = add nsw i32 %i, 143 br label %for.cond44 45for.end:46 ret i32 %sum47}48 49attributes #0 = { cold }50