summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-10-19 04:17:10 +0000
committerXinliang David Li <davidxl@google.com>2015-10-19 04:17:10 +0000
commitaa0592cc70d091389fb04c4c70bf10cef0d93d0f (patch)
treefe79e0833155fe8bdb7aa9c8cc996c02a17d265a /llvm
parentf054e3ad6d433c27dce2393d4631e4753f0536d9 (diff)
downloadbcm5719-llvm-aa0592cc70d091389fb04c4c70bf10cef0d93d0f.tar.gz
bcm5719-llvm-aa0592cc70d091389fb04c4c70bf10cef0d93d0f.zip
[PGO] Eliminate prof data register calls on FreeBSD platform
This is a follow up patch of r250199 after verifying the start/stop section symbols work as spected on FreeBSD. llvm-svn: 250679
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp4
-rw-r--r--llvm/test/Instrumentation/InstrProfiling/platform.ll12
2 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index a92e7f8297b..a68fd3db6c2 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -258,7 +258,9 @@ void InstrProfiling::emitRegistration() {
return;
// Use linker script magic to get data/cnts/name start/end.
- if (Triple(M->getTargetTriple()).isOSLinux()) return;
+ if (Triple(M->getTargetTriple()).isOSLinux() ||
+ Triple(M->getTargetTriple()).isOSFreeBSD())
+ return;
// Construct the function.
auto *VoidTy = Type::getVoidTy(M->getContext());
diff --git a/llvm/test/Instrumentation/InstrProfiling/platform.ll b/llvm/test/Instrumentation/InstrProfiling/platform.ll
index e2c3839d4f1..9fe84b043e2 100644
--- a/llvm/test/Instrumentation/InstrProfiling/platform.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/platform.ll
@@ -2,7 +2,8 @@
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s -check-prefix=MACHO
; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -check-prefix=LINUX
-; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefix=BSD
+; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefix=FREEBSD
+; RUN: opt < %s -mtriple=x86_64-pc-solaris -instrprof -S | FileCheck %s -check-prefix=SOLARIS
@__llvm_profile_name_foo = hidden constant [3 x i8] c"foo"
; MACHO: @__llvm_profile_name_foo = hidden constant [3 x i8] c"foo", section "__DATA,__llvm_prf_names", align 1
@@ -13,7 +14,8 @@
; MACHO: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8
; LINUX: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8
-; BSD: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8
+; FREEBSD: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8
+; SOLARIS: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8
define void @foo() {
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
ret void
@@ -26,8 +28,10 @@ declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
; MACHO-NOT: define internal void @__llvm_profile_register_functions
; LINUX-NOT: define internal void @__llvm_profile_register_functions
-; BSD: define internal void @__llvm_profile_register_functions
+; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
+; SOLARIS: define internal void @__llvm_profile_register_functions
; MACHO-NOT: define internal void @__llvm_profile_init
; LINUX-NOT: define internal void @__llvm_profile_init
-; BSD: define internal void @__llvm_profile_init
+; FREEBSD-NOT: define internal void @__llvm_profile_init
+; SOLARIS: define internal void @__llvm_profile_init
OpenPOWER on IntegriCloud