77 lines · plain
1; RUN: opt -S %s -passes='function(instcombine),sample-profile' -sample-profile-file=%S/Inputs/einline.prof | FileCheck %s2 3; Checks if both call and invoke can be inlined early if their inlined4; instances are hot in profile.5 6target triple = "x86_64-unknown-linux-gnu"7 8@_ZTIi = external constant ptr9 10; Function Attrs: uwtable11define void @_Z3foov() #0 personality ptr @__gxx_personality_v0 !dbg !6 {12 %1 = alloca ptr13 %2 = alloca i3214 %3 = alloca i32, align 415; CHECK: call void @no_inline16 call void @no_inline(), !dbg !1617; CHECK-NOT: call18 call void @_ZL3barv(), !dbg !919; CHECK-NOT: invoke20 invoke void @_ZL3barv()21 to label %4 unwind label %5, !dbg !1022 23; <label>:4:24 ret void25 26; <label>:5:27 %6 = landingpad { ptr, i32 }28 catch ptr @_ZTIi29 ret void30}31 32; Function Attrs: nounwind uwtable33define internal void @_ZL3barv() #0 !dbg !12 {34 ret void35}36 37; CHECK-LABEL: @recursive38define void @recursive() #0 !dbg !13 {39; Recursive calls should not be early-inlined.40; CHECK-NOT: call void @recursive41; CHECK: call void @recursive42; CHECK: call void @recursive43; CHECK-NOT: call void @recursive44; CHECK: ret45 call void @recursive(), !dbg !1446 call void @recursive(), !dbg !1547 ret void48}49 50; The callee has mismatch attributes to the caller, it should not be inlined51define void @no_inline() #1 !dbg !17 {52 ret void53}54 55declare i32 @__gxx_personality_v0(...)56 57attributes #0 = {"target-features"="+sse4.1" "use-sample-profile"}58attributes #1 = {"target-features"="+sse4.2" "use-sample-profile"}59 60!llvm.dbg.cu = !{!0}61!llvm.module.flags = !{!3, !4}62 63!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)64!1 = !DIFile(filename: "a", directory: "b/")65!3 = !{i32 2, !"Dwarf Version", i32 4}66!4 = !{i32 2, !"Debug Info Version", i32 3}67!6 = distinct !DISubprogram(linkageName: "_Z3foov", scope: !1, file: !1, line: 5, scopeLine: 5, unit: !0)68!9 = !DILocation(line: 6, column: 3, scope: !6)69!10 = !DILocation(line: 8, column: 5, scope: !11)70!11 = distinct !DILexicalBlock(scope: !6, file: !1, line: 7, column: 7)71!12 = distinct !DISubprogram(linkageName: "_ZL3barv", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0)72!13 = distinct !DISubprogram(linkageName: "recursive", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0)73!14 = !DILocation(line: 21, column: 3, scope: !13)74!15 = !DILocation(line: 22, column: 3, scope: !13)75!16 = !DILocation(line: 7, column: 3, scope: !6)76!17 = distinct !DISubprogram(linkageName: "no_inline", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0)77