This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build
ClosedPublic

Authored by teemperor on Dec 8 2020, 11:28 AM.

Details

Summary

The LLVM_ENABLE_MODULES builds currently randomly fail due depending on the
headers generated by the intrinsics_gen target, but the current dependency only model
the non-modules dependencies:

While building module 'LLVM_ExecutionEngine' imported from llvm-project/llvm/lib/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.cpp:13:
While building module 'LLVM_intrinsic_gen' imported from llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:17:
In file included from <module-includes>:1:
In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:
llvm/include/llvm/IR/Attributes.h:75:14: fatal error: 'llvm/IR/Attributes.inc' file not found
    #include "llvm/IR/Attributes.inc"
             ^~~~~~~~~~~~~~~~~~~~~~~~

Depending on whether intrinsics_gen runs before compiling Orc/Shared files we either fail or include an outdated Attributes.inc
in module builds. The Clang modules require these additional dependencies as including/importing one module requires all
includes headers by that module to be parsable.

Diff Detail

Event Timeline

teemperor created this revision.Dec 8 2020, 11:28 AM
teemperor requested review of this revision.Dec 8 2020, 11:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2020, 11:28 AM

I'll go ahead and land this to unbreak the bots using Clang modules. Just using this for post-commit review.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 8 2020, 11:42 AM
This revision was automatically updated to reflect the committed changes.

Sorry, I didn't see this over the holidays. Yesterday, I fell over it eventually, got confused and checked the change :-) This was certainly the right thing to do for unblocking the bots. I am not sure, however, if we want to keep it like that in the long-term. OrcShared should only have things that are required by both, OrcJIT and OrcTargetProcess. The former already depends on intrinsics_gen and the latter doesn't need it.

So, what would it take to get rid of it again? I guess the underlying issue is that TargetProcessControlTypes somehow pulls in ExecutionEngine. That shouldn't be necessary. I can reproduce the issue and I will see how to avoid it.