Easwaran Raman | bdf2026 | 2018-01-09 19:39:35 +0000 | [diff] [blame] | 1 | ; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s |
| 2 | |
| 3 | ; CHECK-LABEL: define void @foo() |
| 4 | ; CHECK: !prof ![[COUNT1:[0-9]+]] |
| 5 | define void @foo() { |
| 6 | ret void |
| 7 | } |
| 8 | |
| 9 | ; CHECK-LABEL: define void @foo_inline() #0 |
| 10 | ; CHECK: !prof ![[COUNT2:[0-9]+]] |
| 11 | define void @foo_inline() #0 { |
| 12 | ret void |
| 13 | } |
| 14 | |
| 15 | ; CHECK-LABEL: define void @foo_always_inline() #1 |
| 16 | ; CHECK: !prof ![[COUNT2]] |
| 17 | define void @foo_always_inline() #1 { |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | ; CHECK-LABEL: define void @foo_cold() #2 |
| 22 | ; CHECK: !prof ![[COUNT3:[0-9]+]] |
| 23 | define void @foo_cold() #2 { |
| 24 | ret void |
| 25 | } |
| 26 | |
| 27 | ; CHECK-LABEL: define void @foo_noinline() #3 |
| 28 | ; CHECK: !prof ![[COUNT3]] |
| 29 | define void @foo_noinline() #3 { |
| 30 | ret void |
| 31 | } |
| 32 | |
| 33 | ; CHECK-LABEL: define internal void @foo_local() |
| 34 | ; CHECK: !prof ![[COUNT4:[0-9]+]] |
| 35 | define internal void @foo_local() { |
| 36 | ret void |
| 37 | } |
| 38 | |
| 39 | ; CHECK-LABEL: define internal void @foo_local_escaped() |
| 40 | ; CHECK: !prof ![[COUNT1]] |
| 41 | define internal void @foo_local_escaped() { |
| 42 | ret void |
| 43 | } |
| 44 | |
| 45 | declare void @ext(void ()*) |
| 46 | |
| 47 | define void @bar() { |
| 48 | call void @ext(void ()* nonnull @foo_local_escaped) |
| 49 | ret void |
| 50 | } |
| 51 | |
| 52 | ; CHECK-LABEL: define internal void @foo_local_inline() #0 |
| 53 | ; CHECK: !prof ![[COUNT2]] |
| 54 | define internal void @foo_local_inline() #0 { |
| 55 | ret void |
| 56 | } |
| 57 | |
| 58 | ; CHECK-LABEL: define internal void @foo_local_cold() #2 |
| 59 | ; CHECK: !prof ![[COUNT4]] |
| 60 | define internal void @foo_local_cold() #2 { |
| 61 | ret void |
| 62 | } |
| 63 | |
| 64 | ; CHECK-LABEL: define linkonce void @foo_linkonce() |
| 65 | ; CHECK: !prof ![[COUNT1]] |
| 66 | define linkonce void @foo_linkonce() { |
| 67 | ret void |
| 68 | } |
| 69 | |
| 70 | ; CHECK: ![[COUNT1]] = !{!"synthetic_function_entry_count", i64 10} |
| 71 | ; CHECK: ![[COUNT2]] = !{!"synthetic_function_entry_count", i64 15} |
| 72 | ; CHECK: ![[COUNT3]] = !{!"synthetic_function_entry_count", i64 5} |
| 73 | ; CHECK: ![[COUNT4]] = !{!"synthetic_function_entry_count", i64 0} |
| 74 | |
| 75 | attributes #0 = {inlinehint} |
| 76 | attributes #1 = {alwaysinline} |
| 77 | attributes #2 = {cold} |
| 78 | attributes #3 = {noinline} |
| 79 | |