brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 914ab4f Raw
62 lines · plain
1; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-hot-callsite-threshold.prof -S -pass-remarks=sample-profile -sample-profile-hot-inline-threshold=100 2>&1 | FileCheck %s2 3; CHECK: remark: a.cc:6:12: 'bar' inlined into 'foo' to match profiling context with (cost={{.*}}, threshold=100)4; CHECK:     define dso_local noundef i32 @foo(i32 noundef %0)5; CHECK-NOT:   %2 = tail call noundef i32 @bar(i32 noundef %0)6; CHECK-NEXT:  %2 = icmp sgt i32 %0, 17; CHECK-NEXT:  br i1 %2, label %3, label %bar.exit8 9; Manually lower cost threshold for hot function inlining, so that the function10; is not inlined even profile indicates it as hot.11; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-hot-callsite-threshold.prof -S -pass-remarks=sample-profile -sample-profile-hot-inline-threshold=1 2>&1 | FileCheck %s --check-prefix=COST12 13; COST-NOT:  remark14; COST: define dso_local noundef i32 @foo(i32 noundef %0)15; COST-NEXT: %2 = tail call noundef i32 @bar(i32 noundef %0)16 17define dso_local noundef i32 @bar(i32 noundef %0) #0 !dbg !10 {18  %2 = icmp sgt i32 %0, 119  br i1 %2, label %3, label %15203:                                                ; preds = %121  %4 = add nsw i32 %0, -222  %5 = mul i32 %4, %423  %6 = add i32 %5, %024  %7 = zext nneg i32 %4 to i3325  %8 = add nsw i32 %0, -326  %9 = zext i32 %8 to i3327  %10 = mul i33 %7, %928  %11 = lshr i33 %10, 129  %12 = trunc nuw i33 %11 to i3230  %13 = xor i32 %12, -131  %14 = add i32 %6, %1332  br label %153315:                                               ; preds = %3, %134  %16 = phi i32 [ 0, %1 ], [ %14, %3 ]35  ret i32 %1636}37 38define dso_local noundef i32 @foo(i32 noundef %0) #1 !dbg !20 {39  %2 = tail call noundef i32 @bar(i32 noundef %0), !dbg !2440  ret i32 %241}42 43attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable  "use-sample-profile" }44attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable  "use-sample-profile" }45attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }46 47!llvm.dbg.cu = !{!0}48!llvm.module.flags = !{!2, !3}49 50!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug)51!1 = !DIFile(filename: "a.cc", directory: ".")52!2 = !{i32 2, !"Dwarf Version", i32 4}53!3 = !{i32 2, !"Debug Info Version", i32 3}54!10 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !1, file: !1, line: 1, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0)55!11 = !DIFile(filename: "a.cc", directory: ".")56!12 = !DISubroutineType(types: !13)57!13 = !{!14, !14}58!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)59!20 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !11, file: !11, line: 5, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0)60!23 = !DILocation(line: 0, scope: !20)61!24 = !DILocation(line: 6, column: 12, scope: !20)62