summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2016-02-10 17:18:30 +0000
committerRong Xu <xur@google.com>2016-02-10 17:18:30 +0000
commit33c76c0cc2aac6d78ea0c3b1ed71a0fadbd307d7 (patch)
tree72f293874b989caf7e13fb6dafe4994ae75a883e /llvm/test
parent96449907a538b78c402696d94fe47bb3f96d543c (diff)
downloadbcm5719-llvm-33c76c0cc2aac6d78ea0c3b1ed71a0fadbd307d7.tar.gz
bcm5719-llvm-33c76c0cc2aac6d78ea0c3b1ed71a0fadbd307d7.zip
[PGO] Differentiate Clang instrumentation and IR level instrumentation profiles
This patch uses one bit in profile version to differentiate Clang instrumentation and IR level instrumentation profiles. PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so that the compiler runtime can set the right profile kind. For Maco-O platform, we generate the variable as linkonce_odr linkage as COMDAT is not supported. PGOInstrumenation now checks this bit to make sure it's an IR level instrumentation profile. The patch was submitted as r260164 but reverted due to a Darwin test breakage. Original Differential Revision: http://reviews.llvm.org/D15540 Differential Revision: http://reviews.llvm.org/D17020 llvm-svn: 260385
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/diag.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext5
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/Inputs/switch.proftext2
-rw-r--r--llvm/test/Transforms/PGOProfile/branch1.ll7
-rw-r--r--llvm/test/Transforms/PGOProfile/branch2.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/criticaledge.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/diag_FE_profile.ll12
-rw-r--r--llvm/test/Transforms/PGOProfile/landingpad.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/loop1.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/loop2.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/single_bb.ll2
-rw-r--r--llvm/test/Transforms/PGOProfile/switch.ll2
18 files changed, 53 insertions, 1 deletions
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
index 3e28112706f..8ca9db9c051 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_br_1
25571299074
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
index 7d9bd72b29f..b5fee2b6f4f 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_br_2
29667547796
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
index f369ba7c350..7613b643b16 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_criticalEdge
82323253069
8
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext
index aaa137e3a42..a38d7939ebd 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
foo
12884999999
1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext
new file mode 100644
index 00000000000..aaa137e3a42
--- /dev/null
+++ b/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext
@@ -0,0 +1,5 @@
+foo
+12884999999
+1
+1
+
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
index b2bd451611b..07b1bf86fc7 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
foo
59130013419
4
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
index 58c05fbe167..c19737149ca 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_simple_for
34137660316
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
index 1c429ea5d5f..af3a71df1e6 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_nested_for
53929068288
3
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
index 7b406b87ef7..bebd65fa4c9 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
@@ -1,3 +1,5 @@
+# :ir is the flag to indicate this is IR level profile.
+:ir
test_switch
46200943743
4
diff --git a/llvm/test/Transforms/PGOProfile/branch1.ll b/llvm/test/Transforms/PGOProfile/branch1.ll
index cc354d3425c..543237f6279 100644
--- a/llvm/test/Transforms/PGOProfile/branch1.ll
+++ b/llvm/test/Transforms/PGOProfile/branch1.ll
@@ -1,9 +1,14 @@
-; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
+; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT
+; RUN: opt < %s -mtriple=x86_64-apple-darwin -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE
; RUN: llvm-profdata merge %S/Inputs/branch1.proftext -o %t.profdata
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN-DARWIN-LINKONCE: target triple = "x86_64-apple-darwin"
+; GEN-COMDAT: $__llvm_profile_raw_version = comdat any
+; GEN-COMDAT: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
+; GEN-LINKONCE: @__llvm_profile_raw_version = linkonce constant i64 72057594037927939
; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1"
define i32 @test_br_1(i32 %i) {
diff --git a/llvm/test/Transforms/PGOProfile/branch2.ll b/llvm/test/Transforms/PGOProfile/branch2.ll
index 1e8bc5ec2a3..95a3f1e4fe1 100644
--- a/llvm/test/Transforms/PGOProfile/branch2.ll
+++ b/llvm/test/Transforms/PGOProfile/branch2.ll
@@ -4,6 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_test_br_2 = private constant [9 x i8] c"test_br_2"
define i32 @test_br_2(i32 %i) {
diff --git a/llvm/test/Transforms/PGOProfile/criticaledge.ll b/llvm/test/Transforms/PGOProfile/criticaledge.ll
index 0089bbea155..371b6ef2791 100644
--- a/llvm/test/Transforms/PGOProfile/criticaledge.ll
+++ b/llvm/test/Transforms/PGOProfile/criticaledge.ll
@@ -4,6 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_test_criticalEdge = private constant [17 x i8] c"test_criticalEdge"
; GEN: @__profn__stdin__bar = private constant [11 x i8] c"<stdin>:bar"
diff --git a/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll b/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll
new file mode 100644
index 00000000000..30abe6d3519
--- /dev/null
+++ b/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-profdata merge %S/Inputs/diag_FE.proftext -o %t.profdata
+; RUN: not opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
+
+; CHECK: Not an IR level instrumentation profile
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo() {
+entry:
+ ret i32 0
+}
diff --git a/llvm/test/Transforms/PGOProfile/landingpad.ll b/llvm/test/Transforms/PGOProfile/landingpad.ll
index 33fe62fbae0..f614ec51f58 100644
--- a/llvm/test/Transforms/PGOProfile/landingpad.ll
+++ b/llvm/test/Transforms/PGOProfile/landingpad.ll
@@ -6,6 +6,8 @@ target triple = "x86_64-unknown-linux-gnu"
@val = global i32 0, align 4
@_ZTIi = external constant i8*
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_bar = private constant [3 x i8] c"bar"
; GEN: @__profn_foo = private constant [3 x i8] c"foo"
diff --git a/llvm/test/Transforms/PGOProfile/loop1.ll b/llvm/test/Transforms/PGOProfile/loop1.ll
index aa5aa86b1e5..3284c16a680 100644
--- a/llvm/test/Transforms/PGOProfile/loop1.ll
+++ b/llvm/test/Transforms/PGOProfile/loop1.ll
@@ -4,6 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_test_simple_for = private constant [15 x i8] c"test_simple_for"
define i32 @test_simple_for(i32 %n) {
diff --git a/llvm/test/Transforms/PGOProfile/loop2.ll b/llvm/test/Transforms/PGOProfile/loop2.ll
index ec3e16d461b..786a37d5edc 100644
--- a/llvm/test/Transforms/PGOProfile/loop2.ll
+++ b/llvm/test/Transforms/PGOProfile/loop2.ll
@@ -4,6 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for"
define i32 @test_nested_for(i32 %r, i32 %s) {
diff --git a/llvm/test/Transforms/PGOProfile/single_bb.ll b/llvm/test/Transforms/PGOProfile/single_bb.ll
index f904d09b8e7..2538a9bab7a 100644
--- a/llvm/test/Transforms/PGOProfile/single_bb.ll
+++ b/llvm/test/Transforms/PGOProfile/single_bb.ll
@@ -2,6 +2,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_single_bb = private constant [9 x i8] c"single_bb"
define i32 @single_bb() {
diff --git a/llvm/test/Transforms/PGOProfile/switch.ll b/llvm/test/Transforms/PGOProfile/switch.ll
index 3177dc0bd04..aba624ba538 100644
--- a/llvm/test/Transforms/PGOProfile/switch.ll
+++ b/llvm/test/Transforms/PGOProfile/switch.ll
@@ -4,6 +4,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+; GEN: $__llvm_profile_raw_version = comdat any
+; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat
; GEN: @__profn_test_switch = private constant [11 x i8] c"test_switch"
define void @test_switch(i32 %i) {
OpenPOWER on IntegriCloud