| 1 |
; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/norepeated-icp.prof -S | FileCheck %s |
| 2 |
|
| 3 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 4 |
target triple = "x86_64-unknown-linux-gnu" |
| 5 |
|
| 6 |
@.str = private unnamed_addr constant [5 x i8] c"hoo\0A\00", align 1 |
| 7 |
@p = dso_local global ptr null, align 8 |
| 8 |
@str = private unnamed_addr constant [4 x i8] c"hoo\00", align 1 |
| 9 |
|
| 10 |
; Function Attrs: uwtable mustprogress |
| 11 |
define dso_local void @_Z3hoov() #0 !dbg !7 { |
| 12 |
entry: |
| 13 |
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str), !dbg !9 |
| 14 |
ret void, !dbg !10 |
| 15 |
} |
| 16 |
|
| 17 |
; Function Attrs: nofree nounwind |
| 18 |
declare dso_local noundef i32 @printf(ptr nocapture noundef readonly, ...) |
| 19 |
|
| 20 |
; Function Attrs: uwtable mustprogress |
| 21 |
define dso_local void @_Z3goov() #0 !dbg !11 { |
| 22 |
entry: |
| 23 |
%0 = load ptr, ptr @p, align 8, !dbg !12, !tbaa !13 |
| 24 |
call void %0(), !dbg !17 |
| 25 |
ret void, !dbg !18 |
| 26 |
} |
| 27 |
|
| 28 |
; Check the indirect call in _Z3goov inlined into _Z3foov won't be indirect |
| 29 |
; call promoted for _Z3hoov twice in _Z3foov. |
| 30 |
; CHECK-LABEL: @_Z3foov( |
| 31 |
; CHECK: icmp eq ptr {{.*}} @_Z3hoov |
| 32 |
; CHECK-NOT: icmp eq ptr {{.*}} @_Z3hoov |
| 33 |
; CHECK: ret void |
| 34 |
|
| 35 |
; Function Attrs: uwtable mustprogress |
| 36 |
define dso_local void @_Z3foov() #0 !dbg !19 { |
| 37 |
entry: |
| 38 |
call void @_Z3goov(), !dbg !20 |
| 39 |
ret void, !dbg !21 |
| 40 |
} |
| 41 |
|
| 42 |
; Function Attrs: nofree nounwind |
| 43 |
declare noundef i32 @puts(ptr nocapture noundef readonly) |
| 44 |
|
| 45 |
attributes #0 = { uwtable mustprogress "use-sample-profile" } |
| 46 |
|
| 47 |
!llvm.dbg.cu = !{!0} |
| 48 |
!llvm.module.flags = !{!3, !4, !5} |
| 49 |
!llvm.ident = !{!6} |
| 50 |
|
| 51 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) |
| 52 |
!1 = !DIFile(filename: "1.cc", directory: "") |
| 53 |
!2 = !{} |
| 54 |
!3 = !{i32 7, !"Dwarf Version", i32 4} |
| 55 |
!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 56 |
!5 = !{i32 1, !"wchar_size", i32 4} |
| 57 |
!6 = !{!""} |
| 58 |
!7 = distinct !DISubprogram(name: "hoo", linkageName: "_Z3hoov", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 59 |
!8 = !DISubroutineType(types: !2) |
| 60 |
!9 = !DILocation(line: 2, column: 3, scope: !7) |
| 61 |
!10 = !DILocation(line: 3, column: 1, scope: !7) |
| 62 |
!11 = distinct !DISubprogram(name: "goo", linkageName: "_Z3goov", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 63 |
!12 = !DILocation(line: 7, column: 5, scope: !11) |
| 64 |
!13 = !{!14, !14, i64 0} |
| 65 |
!14 = !{!"any pointer", !15, i64 0} |
| 66 |
!15 = !{!"omnipotent char", !16, i64 0} |
| 67 |
!16 = !{!"Simple C++ TBAA"} |
| 68 |
!17 = !DILocation(line: 7, column: 3, scope: !11) |
| 69 |
!18 = !DILocation(line: 8, column: 1, scope: !11) |
| 70 |
!19 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 10, type: !8, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 71 |
!20 = !DILocation(line: 11, column: 3, scope: !19) |
| 72 |
!21 = !DILocation(line: 12, column: 3, scope: !19) |