Page MenuHomePhabricator

[cmake] Add llvm-locstats to LLVM_TEST_DEPENDS
ClosedPublic

Authored by dstenb on Dec 17 2019, 7:48 AM.

Details

Summary

Make sure that llvm-locstats is updated before running lit tests even
when it's not an explicit target.

Diff Detail

Event Timeline

dstenb created this revision.Dec 17 2019, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2019, 7:48 AM
djtodoro accepted this revision.Dec 17 2019, 8:43 AM

Good change! It sound reasonable to me.

This revision is now accepted and ready to land.Dec 17 2019, 8:43 AM
This revision was automatically updated to reflect the committed changes.

How is this change supposed to interact with LLVM_BUILD_TOOLS?
"LLVM_BUILD_TOOLS: Build the LLVM tools. If OFF, just generate build targets."

We have a downstream build that sets this OFF, then builds llvm-mc only. You can reproduce the same thing with upstream llvm:

$ cmake -G Ninja ../llvm-project/llvm/ -DLLVM_BUILD_TOOLS=OFF
CMake Error at cmake/modules/AddLLVM.cmake:1457 (add_dependencies):
  The dependency target "llvm-locstats" of target "check-llvm-tools-llvm-rc"
  does not exist.
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:1509 (add_lit_target)
  test/CMakeLists.txt:179 (add_lit_testsuites)
<repeats for lots of targets>

Perhaps build tools isn't defining the targets as it claims.

How is this change supposed to interact with LLVM_BUILD_TOOLS?
"LLVM_BUILD_TOOLS: Build the LLVM tools. If OFF, just generate build targets."

We have a downstream build that sets this OFF, then builds llvm-mc only. You can reproduce the same thing with upstream llvm:

$ cmake -G Ninja ../llvm-project/llvm/ -DLLVM_BUILD_TOOLS=OFF
CMake Error at cmake/modules/AddLLVM.cmake:1457 (add_dependencies):
   The dependency target "llvm-locstats" of target "check-llvm-tools-llvm-rc"
   does not exist.
 Call Stack (most recent call first):
   cmake/modules/AddLLVM.cmake:1509 (add_lit_target)
   test/CMakeLists.txt:179 (add_lit_testsuites)
 <repeats for lots of targets>

Perhaps build tools isn't defining the targets as it claims.

Oh, okay!

I see that all other utils/ dependencies in LLVM_TEST_DEPENDS are C++ programs, so they use add_llvm_utility in their CMakeLists.txt, instead of a custom target as is used for llvm-locstats.

I'm unfortunately not very well-versed with LLVM's build system, so I don't have any good fix for this at the moment. I guess that breaking cmake invocations is worse than the issue this patch attempted to fix, so feel free to revert this, or let me know and I'll do that.

No that's fine, no change needed. I think you just uncovered an issue with the way llvm-locstats was defined (or not as the case was).