brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · ab8ebef Raw
77 lines · plain
1; RUN: opt < %s -passes=pgo-icall-prom -S -icp-total-percent-threshold=50 | FileCheck %s --check-prefix=ICALL-PROM2; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS-REMARK3; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=20 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS2-REMARK4; Test minimum count threshold - should prevent func1 promotion (count 10 < threshold 15)5; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-minimum-count-threshold=15 -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=MIN-COUNT-156; Test edge case - threshold exactly at count value7; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-minimum-count-threshold=10 -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=MIN-COUNT-108 9; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 160010; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 57011; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func3 with count 150 out of 16012; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func1 with count 10 out of 1013 14; PASS2-REMARK: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 160015; PASS2-REMARK: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 57016; PASS2-REMARK-NOT: remark: <unknown>:0:0: Promote indirect call to func317; PASS2-REMARK-NOT: remark: <unknown>:0:0: Promote indirect call to func118 19; MIN-COUNT-15: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 160020; MIN-COUNT-15: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 57021; MIN-COUNT-15: remark: <unknown>:0:0: Promote indirect call to func3 with count 150 out of 16022; MIN-COUNT-15-NOT: remark: <unknown>:0:0: Promote indirect call to func123 24; MIN-COUNT-10: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 160025; MIN-COUNT-10: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 57026; MIN-COUNT-10: remark: <unknown>:0:0: Promote indirect call to func3 with count 150 out of 16027; MIN-COUNT-10: remark: <unknown>:0:0: Promote indirect call to func1 with count 10 out of 1028 29target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"30target triple = "x86_64-unknown-linux-gnu"31 32@foo = common global ptr null, align 833 34define i32 @func1() {35entry:36  ret i32 037}38 39define i32 @func2() {40entry:41  ret i32 142}43 44define i32 @func3() {45entry:46  ret i32 247}48 49define i32 @func4() {50entry:51  ret i32 352}53 54define i32 @bar() {55entry:56  %tmp = load ptr, ptr @foo, align 857; ICALL-PROM:   [[CMP:%[0-9]+]] = icmp eq ptr %tmp, @func458; ICALL-PROM:   br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]]59; ICALL-PROM: if.true.direct_targ:60; ICALL-PROM:   [[DIRCALL_RET:%[0-9]+]] = call i32 @func4()61; ICALL-PROM-SAMPLEPGO: call i32 @func4(), !prof [[CALL_METADATA:![0-9]+]]62; ICALL-PROM:   br label %if.end.icp63  %call = call i32 %tmp(), !prof !164; ICALL-PROM: if.false.orig_indirect:65; ICALL-PROM:   %call = call i32 %tmp(), !prof [[NEW_VP_METADATA:![0-9]+]]66  ret i32 %call67; ICALL-PROM: if.end.icp:68; ICALL-PROM:   [[PHI_RET:%[0-9]+]] = phi i32 [ %call, %if.false.orig_indirect ], [ [[DIRCALL_RET]], %if.true.direct_targ ]69; ICALL-PROM:   ret i32 [[PHI_RET]]70}71 72!1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10}73 74; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1030, i32 570}75; ICALL-PROM: [[NEW_VP_METADATA]] = !{!"VP", i32 0, i64 570, i64 -4377547752858689819, i64 410}76; ICALL-PROM-SAMPLEPGO: [[CALL_METADATA]] = !{!"branch_weights", i32 1030}77