This is an archive of the discontinued LLVM Phabricator instance.

[InstrProfiling] Don't generate __llvm_profile_runtime_user
AcceptedPublic

Authored by phosek on Mar 10 2021, 1:11 AM.

Details

Summary

This is no longer needed, we can add __llvm_profile_runtime directly
to llvm.compiler.used or llvm.used to achieve the same effect.

Diff Detail

Event Timeline

phosek created this revision.Mar 10 2021, 1:11 AM
phosek requested review of this revision.Mar 10 2021, 1:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2021, 1:11 AM
vsk accepted this revision.Mar 10 2021, 12:02 PM

Thanks, lgtm.

This revision is now accepted and ready to land.Mar 10 2021, 12:02 PM
hans added a subscriber: hans.Mar 12 2021, 4:57 AM

This broke the check-profile tests on Mac, see e.g. http://green.lab.llvm.org/green/job/clang-stage1-RA/19301/
There are no Mac bots on the main buildbot waterfall, but I thought Apple were watching Green Dragon?

Reverted in f50aef745c3ba981f3d0bf118b809d0c3880a490 to unbreak the builds.

This broke the check-profile tests on Mac, see e.g. http://green.lab.llvm.org/green/job/clang-stage1-RA/19301/
There are no Mac bots on the main buildbot waterfall, but I thought Apple were watching Green Dragon?

I'm getting ERR_CONNECTION_REFUSED when trying to open that URL, how I can see the error?

Reverted in f50aef745c3ba981f3d0bf118b809d0c3880a490 to unbreak the builds.

phosek reopened this revision.Mar 12 2021, 2:08 PM

This broke the check-profile tests on Mac, see e.g. http://green.lab.llvm.org/green/job/clang-stage1-RA/19301/
There are no Mac bots on the main buildbot waterfall, but I thought Apple were watching Green Dragon?

I'm getting ERR_CONNECTION_REFUSED when trying to open that URL, how I can see the error?

Turned out to be an issue with corporate network since Green Dragon doesn't use HTTPS, I've managed to open the page on a personal machine.

This revision is now accepted and ready to land.Mar 12 2021, 2:08 PM

@vsk I managed to reproduce this on Mac and it seems like __llvm_profile_runtime_user is needed in Mach-O. With this change, I see an undefined reference to ___llvm_profile_runtime in the object file, but that doesn't cause the profile runtime to be linked and that symbol is stripped from the binary. I'm not familiar with Mach-O linking semantics so I don't know if this is working as intended or not.

On Linux, the clang driver passes -u__llvm_profile_runtime to the linker: Linux::addProfileRTLibs. Can Mach-O do something similar? The clang driver already does special things with ___llvm_profile_filename and ___llvm_profile_raw_version.

On Linux, the clang driver passes -u__llvm_profile_runtime to the linker: Linux::addProfileRTLibs. Can Mach-O do something similar? The clang driver already does special things with ___llvm_profile_filename and ___llvm_profile_raw_version.

We're actually trying to move away from that model and define __llvm_profile_runtime as needed in the backend, see D98061.