This is an archive of the discontinued LLVM Phabricator instance.

[PGO]: Add llvm main include dir to profile runtime header path.
ClosedPublic

Authored by davidxl on Nov 8 2015, 10:08 AM.

Details

Summary

This is a preparation patch to allow the runtime code to include common definitions including per function header, raw header struct, raw version, raw magic and section names.

Diff Detail

Repository
rL LLVM

Event Timeline

davidxl updated this revision to Diff 39653.Nov 8 2015, 10:08 AM
davidxl retitled this revision from to [PGO]: Add llvm main include dir to profile runtime header path..
davidxl updated this object.
davidxl added reviewers: vsk, bogner.
davidxl added a subscriber: llvm-commits.
vsk edited edge metadata.Nov 9 2015, 3:34 PM

This lgtm.

This revision was automatically updated to reflect the committed changes.
beanz added a subscriber: beanz.Nov 9 2015, 4:55 PM

This code breaks builds with LLVM_EXTERNAL_COMPILER_RT=On or any out-of-tree compiler-rt build.

LLVM_MAIN_INCLUDE_DIR is not always set, and you can't expect it to be set.

vsk added a comment.Nov 9 2015, 5:04 PM

David, it doesn't look like there's a way to directly include files from llvm.

I think we should split out what's needed into an *.inc file and duplicate it between llvm and compiler-rt. This is probably worth a discussion on the list.

davidxl added a subscriber: davidxl.Nov 9 2015, 5:12 PM

I rolled back the change for now.

Chris, what is the use case of out of tree compile-rt build? In
compile-rt.llvm.org, it says "Generally, you need to build LLVM/Clang in
order to build compiler-rt". It seems pointless building it separately.

thanks,

David

beanz added a comment.Nov 9 2015, 5:56 PM

There are a lot of uses of out-of-tree compiler-rt builds.

(1) gcc uses the sanitizers
(2) LLVM_BUILD_EXTERNAL_COMPILER_RT is a CMake option that does an out-of-tree build in-tree. Basically CMake magic to use the just-built clang
(3) we support building Clang out-of-tree against installed LLVM binaries, and those people need to build compiler-rt too.

I'm sure there are more reasons people do this.

We explicitly don't have dependencies between compiler-rt and other LLVM projects because there are people who use compiler-rt with other compilers, and there is no hard technical tie between compiler-rt and clang or LLVM.

-Chris

Longer term we probably need to exclude profile runtime when compiler-rt is build standalone -- however this will have implications and require more discussions in llvm-dev.

The profile runtime refactoring can still be done by extracting ABI related defs into one common file which will be duplicated between profile runtime and LLVM. This won't reduce the profile runtime maintenance overhead to zero, but should be close enough.