1; REQUIRES: x86_64-linux 2; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/merge-function-attributes.afdo -S | FileCheck %s 3 4target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-grtev4-linux-gnu" 6 7; Verify that yyy is inlined into xxx with the function attibutes properly merged. 8; CHECK: define <8 x double> @xxx(){{.*}} #[[ATTRNO:[0-9]+]] 9; CHECK-NEXT: call <8 x double> @llvm.x86.avx512.mask.rndscale.pd.512 10define <8 x double> @xxx() #0 !dbg !5 { 11 %x = call <8 x double> @yyy(), !dbg !7 12 ret <8 x double> %x 13} 14 15define available_externally <8 x double> @yyy() #1 !dbg !8 { 16 %y = call <8 x double> @llvm.x86.avx512.mask.rndscale.pd.512(<8 x double> zeroinitializer, i32 9, <8 x double> zeroinitializer, i8 -1, i32 4) 17 ret <8 x double> %y 18} 19 20; Function Attrs: nounwind readnone 21declare <8 x double> @llvm.x86.avx512.mask.rndscale.pd.512(<8 x double>, i32 immarg, <8 x double>, i8, i32 immarg) #2 22 23; CHECK: attributes #[[ATTRNO]] = { "min-legal-vector-width"="512" 24attributes #0 = { "min-legal-vector-width"="128" "prefer-vector-width"="128" "target-features"="+avx512vl" "use-sample-profile" } 25attributes #1 = { "min-legal-vector-width"="512" "use-sample-profile" } 26attributes #2 = { nounwind readnone } 27 28!llvm.dbg.cu = !{!0, !3} 29!llvm.module.flags = !{!4} 30 31!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) 32!1 = !DIFile(filename: "test.cc", directory: "/proc/self/cwd") 33!2 = !{} 34!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) 35!4 = !{i32 2, !"Debug Info Version", i32 3} 36!5 = distinct !DISubprogram(name: "xxx", linkageName: "xxx", scope: !1, file: !1, line: 11, type: !6, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) 37!6 = !DISubroutineType(types: !2) 38!7 = !DILocation(line: 78, column: 10, scope: !5) 39!8 = distinct !DISubprogram(name: "yyy", linkageName: "yyy", scope: !1, file: !1, line: 270, type: !6, scopeLine: 273, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !3, retainedNodes: !2) 40