This is an archive of the discontinued LLVM Phabricator instance.

[TargetParser] Generate RISCVTargetParserDef only if RISCV is enabled.
AbandonedPublic

Authored by fpetrogalli on Jul 31 2023, 9:16 AM.

Details

Summary

This remove the dependency from the RISCV TableGen target definitions
for builds that do not build the RISCV target.

Diff Detail

Event Timeline

fpetrogalli created this revision.Jul 31 2023, 9:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 9:16 AM
fpetrogalli requested review of this revision.Jul 31 2023, 9:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 9:16 AM

Does this improve build times by a significant amount?

Fix a bug in the way I was setting the cmake variable.

Does this improve build times by a significant amount?

I'd say ~0.75x speedup when building LLVMTargetParser. Mostly because the build of LLVMTargetParser now requires less dependencies (in my specific case, from 188 to 165).

Of course this does not reflect on a full compiler build...

% cmake ../llvm-project/llvm -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86"
% time ninja -j1 LLVMTargetParser
[165/165] Linking CXX static library lib/libLLVMTargetParser.a
ninja -j1 LLVMTargetParser  44.86s user 4.55s system 98% cpu 50.027 total
% cmake ../llvm-project/llvm -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;RISCV"
% time ninja -j1 LLVMTargetParser
[188/188] Linking CXX static library lib/libLLVMTargetParser.a
ninja -j1 LLVMTargetParser  56.60s user 5.70s system 98% cpu 1:03.45 total
jroelofs added inline comments.
llvm/lib/TargetParser/RISCVTargetParser.cpp
42

Will this cause invalid to show up in -mcpu=help? ISTM it would be better if the list were empty when it's not enabled.

Doesn't this change the behaviour of clang -emit-llvm, which is supposed to work the same regardless of what targets you have enabled? If so, NAK.

fpetrogalli abandoned this revision.Jul 31 2023, 12:57 PM

Doesn't this change the behaviour of clang -emit-llvm, which is supposed to work the same regardless of what targets you have enabled? If so, NAK.

Ah - very good point! I didn't know about this. I will abandon the change.

Thanks,

Francesco