summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-06-02 16:33:41 +0000
committerXinliang David Li <davidxl@google.com>2016-06-02 16:33:41 +0000
commit7008ce3f989105a667eab5f34f7ba6fcdc1ba3d8 (patch)
tree5e5101c906e152ec37571679fc7e6361377cf99e /llvm/test/Transforms
parentfd7ddf1479f1f401a8159d37e6058273f67b20c8 (diff)
downloadbcm5719-llvm-7008ce3f989105a667eab5f34f7ba6fcdc1ba3d8.tar.gz
bcm5719-llvm-7008ce3f989105a667eab5f34f7ba6fcdc1ba3d8.zip
[profile] value profiling bug fix -- missing icall targets in profile-use
Inline virtual functions has linkeonceodr linkage (emitted in comdat on supporting targets). If the vtable for the class is not emitted in the defining module, function won't be address taken thus its address is not recorded. At the mercy of the linker, if the per-func prf_data from this module (in comdat) is picked at link time, we will lose mapping from function address to its hash val. This leads to missing icall promotion. The second test case (currently disabled) in compiler_rt (r271528): instrprof-icall-prom.test demostrates the bug. The first profile-use subtest is fine due to linker order difference. With this change, no missing icall targets is found in instrumented clang's raw profile. llvm-svn: 271532
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/PGOProfile/indirect_call_profile.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll b/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll
index 0d934ba7584..e1753acb7c7 100644
--- a/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll
+++ b/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll
@@ -1,8 +1,12 @@
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
+; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefix=LOWER
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
+$foo3 = comdat any
+
@bar = external global void ()*, align 8
; GEN: @__profn_foo = private constant [3 x i8] c"foo"
@@ -49,6 +53,13 @@ bb11: ; preds = %bb2
resume { i8*, i32 } %tmp3
}
+; Test that comdat function's address is recorded.
+; LOWER: @__profd_foo3 = linkonce_odr{{.*}}@foo3
+; Function Attrs: nounwind uwtable
+define linkonce_odr i32 @foo3() comdat {
+ ret i32 1
+}
+
declare i32 @__gxx_personality_v0(...)
; Function Attrs: nounwind readnone
OpenPOWER on IntegriCloud