This is an archive of the discontinued LLVM Phabricator instance.

Use llvm_library_add support for components in Polly
ClosedPublic

Authored by serge-sans-paille on Apr 17 2020, 4:02 AM.

Details

Summary

Instead of manually registering libraries as target_libraries in Polly, use the LINK_COMPONENTS option. It makes Polly's CMakefile easier to read, and generalizes https://reviews.llvm.org/D78332 to all plugins.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
efriedma accepted this revision.Apr 17 2020, 11:37 AM

Makes sense. LGTM

This revision is now accepted and ready to land.Apr 17 2020, 11:37 AM

Patch updated to make compiler extension compatible with LINK_COMPONENTS

@sylvestre.ledru can you check this still work with your setup?

Once rebased on https://reviews.llvm.org/D78192 this one should be much cleaner.

Rebase this patch on https://reviews.llvm.org/D78192, which make sit much cleaner and straight-forward.

@Meinersbur can you confirm this oe is okay with you?

This revision was automatically updated to reflect the committed changes.

I got a new warning when compiling with clang:

In file included from /tmp/persistent/llvm-src/llvm/tools/llvm-config/llvm-config.cpp:51:
tools/llvm-config/ExtensionDependencies.inc:7:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
{"Polly", {"support", "core", "scalaropts", "instcombine", "transformutils", "analysis", "ipo", "mc", "passes", "linker", "irreader", "analysis", "bitreader", "mcparser", "object", "profiledata", "target", "vectorize", "PollyISL", "Polly",nullptr}}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 {                                                                                                                                                                                                                                                      }

I got a new warning when compiling with clang:

In file included from /tmp/persistent/llvm-src/llvm/tools/llvm-config/llvm-config.cpp:51:
tools/llvm-config/ExtensionDependencies.inc:7:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
{"Polly", {"support", "core", "scalaropts", "instcombine", "transformutils", "analysis", "ipo", "mc", "passes", "linker", "irreader", "analysis", "bitreader", "mcparser", "object", "profiledata", "target", "vectorize", "PollyISL", "Polly",nullptr}}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 {                                                                                                                                                                                                                                                      }

Should be fixed by 37309fb02f60557f18971dc575904c0fc56c91ab

aheejin added a subscriber: aheejin.May 1 2020, 8:48 AM

After this commit, builds with -DBUILD_SHARED_LIBS=ON fail.

After this commit, builds with -DBUILD_SHARED_LIBS=ON fail.

Can you share the other cmake options?

This is my full compilation option, but I don't think anything other than -DBUILD_SHARED_LIBS=ON is relevant.

cmake -G Ninja -DCMAKE_C_COMPILER=$HOME/apps/clang+llvm/bin/clang -DCMAKE_CXX_COMPILER=$HOME/apps/clang+llvm/bin/clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DLLVM_TARGETS_TO_BUILD="X86;WebAssembly" -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_ASSERTIONS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-D_GLIBCXX_DEBUG" -DLLVM_INSTALL_UTILS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$HOME/llvm-git/install.debug -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;parallel-libs;polly;pstl;test-suite" ../llvm

@aheejin thanks! I was able to reproduce, https://reviews.llvm.org/D79295 should fix the issue, can you confirm that?