2014-12-09 02:02:35 +08:00
|
|
|
;; Checks for platform specific section names and initialization code.
|
|
|
|
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s -check-prefix=MACHO
|
2016-05-11 07:37:19 +08:00
|
|
|
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s -check-prefix=MACHO
|
2018-07-28 06:21:35 +08:00
|
|
|
; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -check-prefixes=LINUX,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s -check-prefixes=LINUX,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefixes=FREEBSD,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -passes=instrprof -S | FileCheck %s -check-prefixes=FREEBSD,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-scei-ps4 -instrprof -S | FileCheck %s -check-prefixes=PS4,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instrprof -S | FileCheck %s -check-prefixes=PS4,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-pc-solaris -instrprof -S | FileCheck %s -check-prefixes=SOLARIS,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-pc-solaris -passes=instrprof -S | FileCheck %s -check-prefixes=SOLARIS,ELF
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-pc-windows -instrprof -S | FileCheck %s -check-prefix=WINDOWS
|
|
|
|
; RUN: opt < %s -mtriple=x86_64-pc-windows -passes=instrprof -S | FileCheck %s -check-prefix=WINDOWS
|
2014-12-09 02:02:35 +08:00
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
@__profn_foo = hidden constant [3 x i8] c"foo"
|
2017-02-15 04:03:48 +08:00
|
|
|
; MACHO-NOT: __profn_foo
|
|
|
|
; ELF-NOT: __profn_foo
|
2018-07-28 06:21:35 +08:00
|
|
|
; WINDOWS-NOT: __profn_foo
|
2014-12-09 02:02:35 +08:00
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
; MACHO: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
|
|
|
|
; ELF: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
|
[InstrProf] Implement static profdata registration
Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.
Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.
Now, Windows uses static registration and is in line with all the other
platforms.
Reviewers: davidxl, wmi, inglorion, void, calixte
Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D57929
llvm-svn: 353547
2019-02-09 03:03:50 +08:00
|
|
|
; WINDOWS: @__profc_foo = internal global [1 x i64] zeroinitializer, section ".lprfc$M", align 8
|
2014-12-09 02:02:35 +08:00
|
|
|
|
2016-10-12 05:48:16 +08:00
|
|
|
; MACHO: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8
|
2018-07-28 06:21:35 +08:00
|
|
|
; ELF: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
|
[InstrProf] Implement static profdata registration
Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.
Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.
Now, Windows uses static registration and is in line with all the other
platforms.
Reviewers: davidxl, wmi, inglorion, void, calixte
Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D57929
llvm-svn: 353547
2019-02-09 03:03:50 +08:00
|
|
|
; WINDOWS: @__profd_foo = internal global {{.*}}, section ".lprfd$M", align 8
|
2015-11-19 02:14:55 +08:00
|
|
|
|
[InstrProf] Implement static profdata registration
Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.
Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.
Now, Windows uses static registration and is in line with all the other
platforms.
Reviewers: davidxl, wmi, inglorion, void, calixte
Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D57929
llvm-svn: 353547
2019-02-09 03:03:50 +08:00
|
|
|
; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names", align 1
|
|
|
|
; WINDOWS: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}lprfn$M", align 1
|
2016-02-09 02:13:49 +08:00
|
|
|
|
2014-12-09 02:02:35 +08:00
|
|
|
define void @foo() {
|
2015-12-15 08:32:56 +08:00
|
|
|
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
|
2014-12-09 02:02:35 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
|
|
|
|
|
|
|
|
;; Emit registration functions for platforms that don't find the
|
|
|
|
;; symbols by their sections.
|
|
|
|
|
|
|
|
; MACHO-NOT: define internal void @__llvm_profile_register_functions
|
2015-10-14 02:39:48 +08:00
|
|
|
; LINUX-NOT: define internal void @__llvm_profile_register_functions
|
2015-10-19 12:17:10 +08:00
|
|
|
; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
|
2019-06-21 05:27:06 +08:00
|
|
|
; SOLARIS-NOT: define internal void @__llvm_profile_register_functions
|
2016-02-27 14:01:26 +08:00
|
|
|
; PS4-NOT: define internal void @__llvm_profile_register_functions
|
[InstrProf] Implement static profdata registration
Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.
Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.
Now, Windows uses static registration and is in line with all the other
platforms.
Reviewers: davidxl, wmi, inglorion, void, calixte
Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D57929
llvm-svn: 353547
2019-02-09 03:03:50 +08:00
|
|
|
; WINDOWS-NOT: define internal void @__llvm_profile_register_functions
|
2018-07-28 06:21:35 +08:00
|
|
|
|
|
|
|
;; PR38340: When dynamic registration is used, we had a bug where we'd register
|
|
|
|
;; something that's not a __profd_* variable.
|
|
|
|
|
2014-12-09 02:02:35 +08:00
|
|
|
; MACHO-NOT: define internal void @__llvm_profile_init
|
2015-10-14 15:24:14 +08:00
|
|
|
; LINUX-NOT: define internal void @__llvm_profile_init
|
2015-10-19 12:17:10 +08:00
|
|
|
; FREEBSD-NOT: define internal void @__llvm_profile_init
|
2019-06-21 05:27:06 +08:00
|
|
|
; SOLARIS-NOT: define internal void @__llvm_profile_init
|
2016-02-27 14:01:26 +08:00
|
|
|
; PS4-NOT: define internal void @__llvm_profile_init
|
[InstrProf] Implement static profdata registration
Summary:
The motivating use case is eliminating duplicate profile data registered
for the same inline function in two object files. Before this change,
users would observe multiple symbol definition errors with VC link, but
links with LLD would succeed.
Users (Mozilla) have reported that PGO works well with clang-cl and LLD,
but when using LLD without this static registration, we would get into a
"relocation against a discarded section" situation. I'm not sure what
happens in that situation, but I suspect that duplicate, unused profile
information was retained. If so, this change will reduce the size of
such binaries with LLD.
Now, Windows uses static registration and is in line with all the other
platforms.
Reviewers: davidxl, wmi, inglorion, void, calixte
Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D57929
llvm-svn: 353547
2019-02-09 03:03:50 +08:00
|
|
|
; WINDOWS-NOT: define internal void @__llvm_profile_init
|