[compiler-rt] r355044 - [InstrProf] Use separate comdat group for data and counters
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 15:38:44 PST 2019
Author: rnk
Date: Wed Feb 27 15:38:44 2019
New Revision: 355044
URL: http://llvm.org/viewvc/llvm-project?rev=355044&view=rev
Log:
[InstrProf] Use separate comdat group for data and counters
Summary:
I hadn't realized that instrumentation runs before inlining, so we can't
use the function as the comdat group. Doing so can create relocations
against discarded sections when references to discarded __profc_
variables are inlined into functions outside the function's comdat
group.
In the future, perhaps we should consider standardizing the comdat group
names that ELF and COFF use. It will save object file size, since
__profv_$sym won't appear in the symbol table again.
Reviewers: xur, vsk
Subscribers: eraman, hiraditya, cfe-commits, #sanitizers, llvm-commits
Tags: #clang, #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D58737
Modified:
compiler-rt/trunk/test/profile/coverage-inline.cpp
Modified: compiler-rt/trunk/test/profile/coverage-inline.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/coverage-inline.cpp?rev=355044&r1=355043&r2=355044&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/coverage-inline.cpp (original)
+++ compiler-rt/trunk/test/profile/coverage-inline.cpp Wed Feb 27 15:38:44 2019
@@ -1,11 +1,18 @@
+// Test that the instrumentation puts the right linkage on the profile data for
+// inline functions.
// RUN: %clang_profgen -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_1
// RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s
// RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s
-// Test that the instrumentation puts the right linkage on the profile data for
-// inline functions.
+// Again, with optimizations and inlining. This tests that we use comdats
+// correctly.
+// RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t1.o %s -DOBJECT_1
+// RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t2.o %s
+// RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
+// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s
// CHECK: {{.*}}foo{{.*}}:
// CHECK-NEXT: Hash:
More information about the llvm-commits
mailing list