[PATCH] D33299: [Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 04:46:13 PDT 2017


Meinersbur added a comment.

My first tryout failed with this error:

  CMake Error at /usr/share/llvm-3.6/cmake/AddLLVM.cmake:468 (set_output_directory):
    set_output_directory Function invoked with incorrect arguments for function
    named: set_output_directory
  Call Stack (most recent call first):
    /usr/share/llvm-3.6/cmake/AddLLVM.cmake:604 (add_llvm_executable)
    unittests/CMakeLists.txt:9 (add_unittest)
    unittests/Isl/CMakeLists.txt:1 (add_polly_unittest)

i.e. it is using my distribution-provided LLVM which is version 3.6. I wouldn't expect it to work with current version of Polly.

How do I specify which LLVM root to take? Setting `CMAKE_PREFIX_PATH` seems to work, but is it the intended way to do? Could you document it?

Next try by setting `CMAKE_PREFIX_PATH`:

  CMake Error at cmake/polly_macros.cmake:23 (add_library):
    add_library cannot create target "PollyISL" because an imported target with
    the same name already exists.
  Call Stack (most recent call first):
    lib/External/CMakeLists.txt:262 (add_polly_library)

Polly is in my source checkout, so it got included automatically. I can switch it off using `-DLLVM_TOOL_POLLY_BUILD=OFF`. Of course it is not intended to build Polly externally if Polly is already available in LLVM, but it means I have to build some more LLVM builds (static/shared/dylib) around to test this.

With `-DLLVM_TOOL_POLLY_BUILD=OFF` it compiles, but almost all regression tests fail. For instance:

  FAIL: Polly :: ScopInfo/wraping_signed_expr_1.ll (857 of 902)
  ******************** TEST 'Polly :: ScopInfo/wraping_signed_expr_1.ll' FAILED ********************
  Script:
  --
  opt -load /root/build/polly/debug_findinstall/test/../lib/LLVMPolly.so -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names  -polly-scops -analyze < /mnt/c/Users/Meinersbur/src/llvm/tools/polly/test/ScopInfo/wraping_signed_expr_1.ll | FileCheck /mnt/c/Users/Meinersbur/src/llvm/tools/polly/test/ScopInfo/wraping_signed_expr_1.ll
  --
  Exit Code: 2
  
  Command Output (stderr):
  --
  #0 0x00000000013e4c6a (opt+0x13e4c6a)
  #1 0x00000000013e29ee (opt+0x13e29ee)
  #2 0x00000000013e2b62 (opt+0x13e2b62)
  #3 0x00007f3d57bf1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
  #4 0x00007f3d561d89f2 llvm::PointerIntPair<llvm::ilist_node_base<true>*, 1u, unsigned int, llvm::PointerLikeTypeTraits<llvm::ilist_node_base<true>*>, llvm::PointerIntPairInfo<llvm::ilist_node_base<true>*, 1u, llvm::PointerLikeTypeTraits<llvm::ilist_node_base<true>*> > >::getInt() const /root/install/llvm/release_nopolly/include/llvm/ADT/PointerIntPair.h:59:0
  #5 0x00007f3d561d4312 llvm::ilist_node_base<true>::isSentinel() const /root/install/llvm/release_nopolly/include/llvm/ADT/ilist_node_base.h:46:0
  #6 0x00007f3d561d4332 llvm::ilist_node_base<true>::isKnownSentinel() const /root/install/llvm/release_nopolly/include/llvm/ADT/ilist_node_base.h:47:0
  #7 0x00007f3d561e234f llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void>, false, false>::operator*() const /root/install/llvm/release_nopolly/include/llvm/ADT/ilist_iterator.h:139:0
  #8 0x00007f3d561d8cf5 llvm::simple_ilist<llvm::BasicBlock>::front() /root/install/llvm/release_nopolly/include/llvm/ADT/simple_ilist.h:134:0
  #9 0x00007f3d561d4e44 llvm::Function::front() /root/install/llvm/release_nopolly/include/llvm/IR/Function.h:557:0
  #10 0x00007f3d561d4e26 llvm::Function::getEntryBlock() /root/install/llvm/release_nopolly/include/llvm/IR/Function.h:534:0
  #11 0x00007f3d561d0bb8 polly::ScopDetection::isValidRegion(polly::ScopDetection::DetectionContext&) const /root/src/llvm/tools/polly/lib/Analysis/ScopDetection.cpp:1510:0
  #12 0x00007f3d561cf9d2 polly::ScopDetection::findScops(llvm::Region&) /root/src/llvm/tools/polly/lib/Analysis/ScopDetection.cpp:1330:0
  #13 0x00007f3d561cfaf1 polly::ScopDetection::findScops(llvm::Region&) /root/src/llvm/tools/polly/lib/Analysis/ScopDetection.cpp:1341:0
  #14 0x00007f3d561cab8a polly::ScopDetection::ScopDetection(llvm::Function&, llvm::DominatorTree const&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::RegionInfo&, llvm::AAResults&) /root/src/llvm/tools/polly/lib/Analysis/ScopDetection.cpp:295:0
  #15 0x00007f3d561d1b10 polly::ScopDetectionWrapperPass::runOnFunction(llvm::Function&) /root/src/llvm/tools/polly/lib/Analysis/ScopDetection.cpp:1698:0
  #16 0x0000000000ef5b33 (opt+0xef5b33)
  #17 0x0000000000ef5bfc (opt+0xef5bfc)
  #18 0x0000000000ef569d (opt+0xef569d)
  #19 0x000000000066aa8b (opt+0x66aa8b)
  #20 0x00007f3d56910830 __libc_start_main /build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
  #21 0x00000000006a9559 (opt+0x6a9559)
  Stack dump:
  0.      Program arguments: opt -load /root/build/polly/debug_findinstall/test/../lib/LLVMPolly.so -polly-process-unprofitable -polly-remarks-minimal -polly-use-llvm-names -polly-scops -analyze
  1.      Running pass 'Function Pass Manager' on module '<stdin>'.
  2.      Running pass 'Polly - Detect static control parts (SCoPs)' on function '@wrap'
  FileCheck error: '-' is empty.
  FileCheck command line:  FileCheck /mnt/c/Users/Meinersbur/src/llvm/tools/polly/test/ScopInfo/wraping_signed_expr_1.ll
  
  --
  
  ********************

There seem to be some link incompatibilities, but it works with in-LLVM-tree builds.



================
Comment at: CMakeLists.txt:27
+  else()
+    execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --src-root
+      OUTPUT_VARIABLE MAIN_SRC_DIR
----------------
`LLVM_INSTALL_ROOT` is nowhere defined.


https://reviews.llvm.org/D33299





More information about the llvm-commits mailing list