MaskRay added a comment.

> This approach was already used prior to 9a041a75221ca, but we changed it to 
> always generate the llvm_profile_runtime due to a TAPI limitation.

D43794 <https://reviews.llvm.org/D43794> (rG9a041a75221ca 
<https://reviews.llvm.org/rG9a041a75221cadaafbf902e8ec6b73f6d2612d89>) does not 
seem to affect the ELF behavior.

> We can stop passing -u__llvm_profile_runtime to the linker on Linux and 
> Fuchsia since the generated undefined symbol in each translation unit that 
> needed it serves the same purpose.

This restores the behavior before @davidxl's 
rG170cd100ed6f38ec5826dbd1bd6930ddfd3490a4 
<https://reviews.llvm.org/rG170cd100ed6f38ec5826dbd1bd6930ddfd3490a4> (2015).
While having less code in the clang driver side is pros to me, I don't know 
whether it should come with the cost of conditional presence/absence of the 
.profraw file.
(you can specify LLVM_PROFILE_FILE without %m; -fprofile-profile-generate by 
default does not use %m)

>> There are also going to be binaries in our system build that don't use foo.h 
>> and ideally shouldn't have any overhead since nothing inside them is 
>> instrumented (they should behave as if -fprofile-instr-generate wasn't set 
>> for them at all). That's not the case today because if you set 
>> -fprofile-instr-generate, driver passes -u__llvm_profile_runtime to the 
>> linker which "pulls in" the profile runtime introducing some extra bloat and 
>> startup overhead I described earlier.
>>
>> The overhead is just __llvm_profile_write_file, right? It just writes a 100+ 
>> bytes file which has very little overhead.
>
> It could be more if you use the continuous mode where you'd also need to mmap 
> the profile and do some additional setup.

Can the cost be avoided in the runtime?



================
Comment at: llvm/test/Instrumentation/InstrProfiling/linkage.ll:13
 ; MACHO: @__llvm_profile_runtime = external global i32
-; ELF-NOT: @__llvm_profile_runtime = external global i32
 
----------------
If the symbol is now present, a CHECK line should be kept.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98061/new/

https://reviews.llvm.org/D98061

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to