[PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-12 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

Great, one benefit of this is that zlib can now be detected in non-system libs. 
Maybe we should handle ncurses / TERMINFO in a similar manner? It currently has 
similar logic as finding zlib had


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87590: Backport D79219, D85820, D86134 to 10.0 branch

2020-09-15 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

D86134  should not be added, it was reverted 
afterwards. What eventually landed was D85820 
, which adds a better fix for what D86134 
 was supposed to solve.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87590/new/

https://reviews.llvm.org/D87590

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87590: Backport D79219, D85820, D86134 to 10.0 branch

2020-09-15 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

Also note that the changes are not likely to be backported to 11 even: 
https://reviews.llvm.org/rG31e5f7120bdd2f76337686d9d169b1c00e6ee69c#942622


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87590/new/

https://reviews.llvm.org/D87590

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-19 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added inline comments.



Comment at: llvm/lib/Support/CMakeLists.txt:217
+  endif()
+  if(CMAKE_SHARED_LIBRARY_PREFIX AND CMAKE_SHARED_LIBRARY_SUFFIX AND
+  zlib_library MATCHES 
"^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")

This will not work on macOS since cmake will find stub libraries by default 
(/path/to/libz.tbd), see 
https://github.com/Kitware/CMake/blob/master/Modules/Platform/Darwin.cmake#L71 
for the search order.

Instead you most likely want to use `CMAKE_FIND_LIBRARY_PREFIXES` and 
`CMAKE_FIND_LIBRARY_SUFFIXES`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97340: [HIP] Support Spack packages

2021-05-22 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.
Herald added a subscriber: ormris.

Hi @tra and @yaxunl, I'm commenting as a reviewer of the spack pull request for 
the rocm 4.2.0 ecosystem. First of all: thanks for caring about spack 
installations, that's highly appreciated.

However, this patch does not seem the right approach to me, for a couple 
reasons:

1. LLVM should not be aware of spack -- it doesn't make sense. Spack doesn't 
even have a stable 1.0 release, expect it to break and inconsistent between 
versions.
2. It's incorrect in multiple ways: (a) the directory structure name is 
configurable in spack, not everybody has this -- 
structure, so you shouldn't rely on it, (b) you are still not guaranteed to 
pick up the correct llvm-amdgpu because it may be installed in a chained repo 
on a shared HPC system, and it won't be in the same prefix folder at all (c) 
spack's main selling point is it supports multiple installs of one package (a 
hash also changes for the same llvm version if a downstream dep such as zlib is 
updated), this patch just bails when it detect multiple installations

Let's step back a bit. The problem you seem to be solving is the circular 
dependency between llvm and rocm-device-libs which are separate packages in 
spack; clang can't know where rocm-device-libs is at compile time because 
rocm-device-libs depends on llvm.

Clearly the solution is to build llvm together with rocm-device-libs, as 
explained in the readme of 
https://github.com/RadeonOpenCompute/ROCm-Device-Libs, we can fix that in spack 
by adding a `resource` in the llvm package to pull in more sources, and LLVM 
can happily live without knowing about spack.

Thanks,

Harmen


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97340/new/

https://reviews.llvm.org/D97340

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97340: [HIP] Support Spack packages

2021-05-22 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie reopened this revision.
haampie added a comment.
This revision is now accepted and ready to land.

I've created a pull request to spack here: 
https://github.com/spack/spack/pull/23859, hopefully that's enough to revert 
this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97340/new/

https://reviews.llvm.org/D97340

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97340: [HIP] Support Spack packages

2021-05-24 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.
Herald added a subscriber: foad.

Hi Yaxunl,

> The patch should not cause circular dependency on HIP or device library.

I'm not saying this patch introduces a circular dependency, I'm saying you are 
trying to solve an already existing circular dependency (clang needs device 
libs at runtime, but device libs need llvm to compile).

Let's talk about my PR here: https://github.com/spack/spack/pull/23859. It's 
building rocm-device-libs as part of llvm-amdgpu by configuring llvm with 
`-DLLVM_EXTERNAL_PROJECTS=device-libs`.

If you checkout that pr, run `spack install hip@4.2.0`, what you get is get is:

  $ spack find -p llvm-amdgpu@4.2.0
  llvm-amdgpu@4.2.0  
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi

And indeed the bitcode is there:

  $ find 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi
 -iname '*.bc'
  
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/oclc_isa_version_1033.bc
  
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/ocml.bc
  
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/hip.bc
  ...

Now when I used this `--print-rocm-search-dirs` flag on clang without other 
flags, what I see is:

  $ 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/bin/clang++
 --print-rocm-search-dirs -x hip hi.cc 
  ROCm installation search path (Spack 4.2.0): 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0
  ROCm installation search path: 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/lib/clang/12.0.0
  ROCm installation search path: /opt/rocm
  ...
  clang-12: error: cannot find ROCm device library. Provide its path via 
--rocm-path or --rocm-device-lib-path, or pass -nogpulib to build without ROCm 
device library.

Now can you make it such that clang will search the llvm prefix itself?

In fact, if you just reduces ALL 3 search paths to just CMAKE_INSTALL_PREFIX 
path, it will find the correct bitcode files independent of whether you're 
using spack or whether you're bundling the rocm packages the traditional way in 
with the shared prefix in /opt/rocm... So, what I'd like to see is this:

  $ 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/bin/clang++
 --print-rocm-search-dirs -x hip hi.cc 
  ROCm installation search path: 
/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/

and

  $ /opt/rocm/bin/clang++ --print-rocm-search-dirs -x hip hi.cc 
  ROCm installation search path: /opt/rocm

Doesn't that make a whole lot more sense than informing llvm about spack?

Finally, it doesn't settle locating hipcc (nor `.hipVersion), but that 
shouldn't be a real issue from the point of view of a spack user, since spack 
already sets the `-I` and `-L` flags for you when you make your package depend 
on `hip`.

Finally,


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97340/new/

https://reviews.llvm.org/D97340

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95119: Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk

2021-01-27 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

@JDevlieghere, would you care to review? This is another instance of moving 
away from system binaries to whatever the user / package manager wants the 
build to use.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95119/new/

https://reviews.llvm.org/D95119

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95119: Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk

2021-01-28 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie updated this revision to Diff 319871.
haampie added a comment.
Herald added a subscriber: arphaman.

I dropped the awk bits, since there's no portable way to do it there, and 
replaced all `perl -w` with `perl` and `use warnings`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95119/new/

https://reviews.llvm.org/D95119

Files:
  clang/test/make_test_dirs.pl
  clang/tools/scan-build/bin/set-xcode-analyzer
  clang/utils/TestUtils/pch-test.pl
  clang/utils/analyzer/reducer.pl
  clang/utils/analyzer/update_plist_test.pl
  clang/www/demo/index.cgi
  debuginfo-tests/llgdb-tests/test_debuginfo.pl
  lldb/docs/use/python-reference.rst
  lldb/scripts/disasm-gdb-remote.pl
  llvm/utils/GenLibDeps.pl
  llvm/utils/codegen-diff
  llvm/utils/findsym.pl
  llvm/utils/llvm-compilers-check
  llvm/utils/llvm-native-gxx
  openmp/runtime/tools/check-execstack.pl
  openmp/runtime/tools/check-instruction-set.pl
  openmp/runtime/tools/message-converter.pl
  polly/lib/External/isl/doc/mypod2latex

Index: polly/lib/External/isl/doc/mypod2latex
===
--- polly/lib/External/isl/doc/mypod2latex
+++ polly/lib/External/isl/doc/mypod2latex
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 use Pod::LaTeX;
Index: openmp/runtime/tools/message-converter.pl
===
--- openmp/runtime/tools/message-converter.pl
+++ openmp/runtime/tools/message-converter.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: openmp/runtime/tools/check-instruction-set.pl
===
--- openmp/runtime/tools/check-instruction-set.pl
+++ openmp/runtime/tools/check-instruction-set.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: openmp/runtime/tools/check-execstack.pl
===
--- openmp/runtime/tools/check-execstack.pl
+++ openmp/runtime/tools/check-execstack.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: llvm/utils/llvm-native-gxx
===
--- llvm/utils/llvm-native-gxx
+++ llvm/utils/llvm-native-gxx
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # Wrapper around LLVM tools to generate a native .o from llvm-gxx using an
 # LLVM back-end (CBE by default).
 
Index: llvm/utils/llvm-compilers-check
===
--- llvm/utils/llvm-compilers-check
+++ llvm/utils/llvm-compilers-check
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ##===- utils/llvmbuild - Build the LLVM project *-python-*-===##
 #
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Index: llvm/utils/findsym.pl
===
--- llvm/utils/findsym.pl
+++ llvm/utils/findsym.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Program:  findsym.pl
 #
@@ -8,6 +8,8 @@
 # Syntax:   findsym.pl  
 #
 
+use warnings;
+
 # Give first option a name.
 my $Directory = $ARGV[0];
 my $Symbol = $ARGV[1];
Index: llvm/utils/codegen-diff
===
--- llvm/utils/codegen-diff
+++ llvm/utils/codegen-diff
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use Getopt::Std;
 $DEBUG = 0;
Index: llvm/utils/GenLibDeps.pl
===
--- llvm/utils/GenLibDeps.pl
+++ llvm/utils/GenLibDeps.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # Program:  GenLibDeps.pl
 #
Index: lldb/scripts/disasm-gdb-remote.pl
===
--- lldb/scripts/disasm-gdb-remote.pl
+++ lldb/scripts/disasm-gdb-remote.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 
Index: lldb/docs/use/python-reference.rst
===
--- lldb/docs/use/python-reference.rst
+++ lldb/docs/use/python-reference.rst
@@ -595,7 +595,7 @@
 
 ::
 
-  #!/usr/bin/python
+  #!/usr/bin/env python
 
   import lldb
   import commands
@@ -703,7 +703,7 @@
 
 ::
 
-  #!/usr/bin/python
+  #!/usr/bin/env python
 
   import lldb
   import os
Index: debuginfo-tests/llgdb-tests/test_debuginfo.pl
===
--- debuginfo-tests/llgdb-tests/test_debuginfo.pl
+++ debuginfo-tests/llgdb-tests/test_debuginfo.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # This script tests debugging information generated by a compiler.
 # Input arguments
Index: clang/www/demo

[PATCH] D95119: Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk

2021-02-24 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

Should this be merged?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95119/new/

https://reviews.llvm.org/D95119

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95119: Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk

2021-02-24 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie added a comment.

I don't have commit access, would be great if you could do that for me!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95119/new/

https://reviews.llvm.org/D95119

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95119: Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk

2021-01-21 Thread Harmen Stoppels via Phabricator via cfe-commits
haampie created this revision.
haampie added a reviewer: JDevlieghere.
Herald added a reviewer: bollu.
haampie requested review of this revision.
Herald added projects: clang, Sanitizers, LLDB, OpenMP, LLVM.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits.

Allow users to use a non-system version of perl, python and awk, which is 
useful in certain package managers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95119

Files:
  clang/test/make_test_dirs.pl
  clang/tools/scan-build/bin/set-xcode-analyzer
  clang/utils/TestUtils/pch-test.pl
  clang/utils/analyzer/reducer.pl
  clang/utils/analyzer/update_plist_test.pl
  compiler-rt/utils/generate_netbsd_ioctls.awk
  compiler-rt/utils/generate_netbsd_syscalls.awk
  debuginfo-tests/llgdb-tests/test_debuginfo.pl
  lldb/docs/use/python-reference.rst
  lldb/scripts/disasm-gdb-remote.pl
  llvm/utils/GenLibDeps.pl
  llvm/utils/codegen-diff
  llvm/utils/findsym.pl
  llvm/utils/llvm-compilers-check
  llvm/utils/llvm-native-gxx
  openmp/runtime/tools/check-execstack.pl
  openmp/runtime/tools/check-instruction-set.pl
  openmp/runtime/tools/message-converter.pl
  polly/lib/External/isl/doc/mypod2latex

Index: polly/lib/External/isl/doc/mypod2latex
===
--- polly/lib/External/isl/doc/mypod2latex
+++ polly/lib/External/isl/doc/mypod2latex
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 use Pod::LaTeX;
Index: openmp/runtime/tools/message-converter.pl
===
--- openmp/runtime/tools/message-converter.pl
+++ openmp/runtime/tools/message-converter.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: openmp/runtime/tools/check-instruction-set.pl
===
--- openmp/runtime/tools/check-instruction-set.pl
+++ openmp/runtime/tools/check-instruction-set.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: openmp/runtime/tools/check-execstack.pl
===
--- openmp/runtime/tools/check-execstack.pl
+++ openmp/runtime/tools/check-execstack.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 #//===--===//
Index: llvm/utils/llvm-native-gxx
===
--- llvm/utils/llvm-native-gxx
+++ llvm/utils/llvm-native-gxx
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # Wrapper around LLVM tools to generate a native .o from llvm-gxx using an
 # LLVM back-end (CBE by default).
 
Index: llvm/utils/llvm-compilers-check
===
--- llvm/utils/llvm-compilers-check
+++ llvm/utils/llvm-compilers-check
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ##===- utils/llvmbuild - Build the LLVM project *-python-*-===##
 #
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Index: llvm/utils/findsym.pl
===
--- llvm/utils/findsym.pl
+++ llvm/utils/findsym.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
 #
 # Program:  findsym.pl
 #
Index: llvm/utils/codegen-diff
===
--- llvm/utils/codegen-diff
+++ llvm/utils/codegen-diff
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use Getopt::Std;
 $DEBUG = 0;
Index: llvm/utils/GenLibDeps.pl
===
--- llvm/utils/GenLibDeps.pl
+++ llvm/utils/GenLibDeps.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
 #
 # Program:  GenLibDeps.pl
 #
Index: lldb/scripts/disasm-gdb-remote.pl
===
--- lldb/scripts/disasm-gdb-remote.pl
+++ lldb/scripts/disasm-gdb-remote.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 
Index: lldb/docs/use/python-reference.rst
===
--- lldb/docs/use/python-reference.rst
+++ lldb/docs/use/python-reference.rst
@@ -595,7 +595,7 @@
 
 ::
 
-  #!/usr/bin/python
+  #!/usr/bin/env python
 
   import lldb
   import commands
@@ -703,7 +703,7 @@
 
 ::
 
-  #!/usr/bin/python
+  #!/usr/bin/env python
 
   import lldb
   import os
Index: debuginfo-tests/llgdb-tests/test_debuginfo.pl
===
--- debuginfo-tests/llgdb-tests/test_debuginfo.pl
+++ debuginfo-tests/llgdb-tests/test_debuginfo.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # This script tests debugg