1 ; RUN: rm -rf %t && split-file %s %t
3 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
4 ; RUN: -xcoff-traceback-table=false < %t/no-ref.ll | FileCheck %s --check-prefixes=NOREF
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
6 ; RUN: -xcoff-traceback-table=false --filetype=obj < %t/no-ref.ll -o %t/no-ref.o
7 ; RUN: llvm-objdump %t/no-ref.o -r | FileCheck %s --check-prefix=NOREF-OBJ
9 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
10 ; RUN: -xcoff-traceback-table=false < %t/no-vnds.ll | FileCheck %s --check-prefixes=NOVNDS
11 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
12 ; RUN: -xcoff-traceback-table=false --filetype=obj < %t/no-vnds.ll -o %t/no-vnds.o
13 ; RUN: llvm-objdump %t/no-vnds.o -r | FileCheck %s --check-prefix=NOVNDS-OBJ
15 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
16 ; RUN: -xcoff-traceback-table=false < %t/with-vnds.ll | FileCheck %s --check-prefixes=WITHVNDS
17 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
18 ; RUN: -xcoff-traceback-table=false --filetype=obj < %t/with-vnds.ll -o %t/with-vnds.o
19 ; RUN: llvm-objdump %t/with-vnds.o -tr | FileCheck %s --check-prefix=WITHVNDS-OBJ
22 ; The absence of a __llvm_prf_cnts section should stop generating the .refs.
24 target datalayout = "E-m:a-p:32:32-i64:64-n32"
25 target triple = "powerpc-ibm-aix7.2.0.0"
27 @__profd_main = private global i64 zeroinitializer, section "__llvm_prf_data", align 8
28 @__llvm_prf_nm = private constant [6 x i8] c"\04\00main", section "__llvm_prf_names", align 1
30 @llvm.used = appending global [2 x ptr]
32 ptr @__llvm_prf_nm], section "llvm.metadata"
34 define i32 @main() #0 {
39 ; NOREF-NOT: .ref __llvm_prf_data
40 ; NOREF-NOT: .ref __llvm_prf_names
41 ; NOREF-NOT: .ref __llvm_prf_vnds
43 ; NOREF-OBJ-NOT: R_REF __llvm_prf_data
44 ; NOREF-OBJ-NOT: R_REF __llvm_prf_names
45 ; NOREF-OBJ-NOT: R_REF __llvm_prf_vnds
48 ; This is the most common case. When -fprofile-generate is used and there exists executable code, we generate the __llvm_prf_cnts, __llvm_prf_data, and __llvm_prf_names sections.
50 target datalayout = "E-m:a-p:32:32-i64:64-n32"
51 target triple = "powerpc-ibm-aix7.2.0.0"
53 @__profc_main = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
54 @__profd_main = private global i64 zeroinitializer, section "__llvm_prf_data", align 8
55 @__llvm_prf_nm = private constant [6 x i8] c"\04\00main", section "__llvm_prf_names", align 1
57 @llvm.used = appending global [3 x ptr]
60 ptr @__llvm_prf_nm], section "llvm.metadata"
62 define i32 @main() #0 {
66 ; There will be two __llvm_prf_cnts .csects, one to represent the actual csect
67 ; that holds @__profc_main, and one generated to hold the .ref directives. In
68 ; XCOFF, a csect can be defined in pieces, so this is is legal assembly.
70 ; NOVNDS: .csect __llvm_prf_cnts[RW],3
71 ; NOVNDS: .csect __llvm_prf_cnts[RW],3
72 ; NOVNDS-NEXT: .ref __llvm_prf_data[RW]
73 ; NOVNDS-NEXT: .ref __llvm_prf_names[RO]
74 ; NOVNDS-NOT: .ref __llvm_prf_vnds
76 ; NOVNDS-OBJ: 00000008 R_REF __llvm_prf_data
77 ; NOVNDS-OBJ: 00000008 R_REF __llvm_prf_names
78 ; NOVNDS-OBJ-NOT: R_REF __llvm_prf_vnds
81 ; When value profiling is needed, the PGO instrumentation generates variables in the __llvm_prf_vnds section, so we generate a .ref for them too.
83 @__profc_main = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
84 @__profd_main = private global i64 zeroinitializer, section "__llvm_prf_data", align 8
85 @__llvm_prf_nm = private constant [6 x i8] c"\04\00main", section "__llvm_prf_names", align 1
86 @__llvm_prf_vnodes = private global [10 x { i64, i64, ptr }] zeroinitializer, section "__llvm_prf_vnds"
88 @llvm.used = appending global [4 x ptr]
92 ptr @__llvm_prf_vnodes], section "llvm.metadata"
94 define i32 @main() #0 {
99 ; WITHVNDS: .csect __llvm_prf_cnts[RW],3
100 ; WITHVNDS: .csect __llvm_prf_cnts[RW],3
101 ; WITHVNDS-NEXT: .ref __llvm_prf_data[RW]
102 ; WITHVNDS-NEXT: .ref __llvm_prf_names[RO]
103 ; WITHVNDS-NEXT: .ref __llvm_prf_vnds[RW]
105 ; WITHVNDS-OBJ: SYMBOL TABLE:
106 ; WITHVNDS-OBJ-NEXT: 00000000 df *DEBUG* 00000000 <stdin>
107 ; WITHVNDS-OBJ-NEXT: 00000000 l .text 00000008 .text
108 ; WITHVNDS-OBJ-NEXT: 00000000 g F .text (csect: .text) 00000000 .main
109 ; WITHVNDS-OBJ-NEXT: 00000008 l .text 00000006 __llvm_prf_names
110 ; WITHVNDS-OBJ-NEXT: 00000010 l O .data 00000008 __llvm_prf_cnts
111 ; WITHVNDS-OBJ-NEXT: 00000018 l O .data 00000008 __llvm_prf_data
112 ; WITHVNDS-OBJ-NEXT: 00000020 l O .data 000000f0 __llvm_prf_vnds
113 ; WITHVNDS-OBJ-NEXT: 00000110 g O .data 0000000c main
114 ; WITHVNDS-OBJ-NEXT: 0000011c l .data 00000000 TOC
116 ; WITHVNDS-OBJ: RELOCATION RECORDS FOR [.data]:
117 ; WITHVNDS-OBJ-NEXT: OFFSET TYPE VALUE
118 ; WITHVNDS-OBJ-NEXT: 00000008 R_REF __llvm_prf_data
119 ; WITHVNDS-OBJ-NEXT: 00000008 R_REF __llvm_prf_names
120 ; WITHVNDS-OBJ-NEXT: 00000008 R_REF __llvm_prf_vnds
121 ; WITHVNDS-OBJ-NEXT: 00000100 R_POS .main
122 ; WITHVNDS-OBJ-NEXT: 00000104 R_POS TOC