Changes

Summary

  1. build: explicitly set the linker language for unwind (details)
  2. [cmake] Add an option to skip stripping before install (details)
  3. Optimize std::midpoint for integers (details)
  4. [BPF] Fix CO-RE bugs with bitfields (details)
  5. [CUDA][HIP] Disable emitting llvm.linker.options in device compilation (details)
  6. [analyzer] Add test directory for scan-build. (details)
Commit 6db7a5cd7c800a588e94ce5c1ef24ae4d60ecdd3 by Saleem Abdulrasool
build: explicitly set the linker language for unwind
The unwinder should not depend on libc++.  In fact, we do not end up
with a link against libc++ as we do not have a dependency on libc++ at
runtime.  This ensures that we link with `clang` rather than `clang++`.
The file was modifiedlibunwind/src/CMakeLists.txt
Commit 610f80f7baea5e46c0ccd4cbb905a679c7c56a05 by Vedant Kumar
[cmake] Add an option to skip stripping before install
The swift build system has support for cross-compiling, installing, and
generating symbols for lldb. As the swift symbol-generation step occurs
after installation, we need to disable stripping during the install.
The file was modifiedlldb/cmake/modules/AddLLDB.cmake
The file was modifiedlldb/cmake/modules/LLDBConfig.cmake
Commit 586952f4cefd809b7becd16c6d1e751ea923adfd by jorg
Optimize std::midpoint for integers
Same idea as the current algorithm, that is, add (half of the difference
between a and b) to a.
But we use a different technique for computing the difference: we
compute b - a into a pair of integers that are named "sign_bit" and
"diff". We have to use a pair because subtracting two 32-bit integers
produces a 33-bit result.
Computing half of that is a simple matter of shifting diff right by 1,
and adding sign_bit shifted left by 31. llvm knows how to do that with
one instruction: shld.
The only tricky part is that if the difference is odd and negative, then
shifting it by one isn't the same as dividing it by two - shifting a
negative one produces a negative one, for example. So there's one more
adjustment: if the sign bit and the low bit of diff are one, we add one.
For a demonstration of the codegen difference, see
https://godbolt.org/z/7ar3K9 , which also has a built-in test.
Differential Revision: https://reviews.llvm.org/D69459
The file was modifiedlibcxx/include/numeric
Commit fff2721286e1c051c2b1c91210ddc3e6a9b179e1 by yhs
[BPF] Fix CO-RE bugs with bitfields
bitfield handling is not robust with current implementation. I have seen
two issues as described below.
Issue 1:
struct s {
   long long f1;
   char f2;
   char b1:1;
} *p;
The current approach will generate an access bit size
56 (from b1 to the end of structure) which will be
rejected as it is not power of 2.
Issue 2:
struct s {
   char f1;
   char b1:3;
   char b2:5;
   char b3:6:
   char b4:2;
   char f2;
};
The LLVM will group 4 bitfields together with 2 bytes. But
loading 2 bytes is not correct as it violates alignment
requirement. Note that sometimes, LLVM breaks a large
bitfield groups into multiple groups, but not in this case.
To resolve the above two issues, this patch takes a different approach.
The alignment for the structure is used to construct the offset of the
bitfield access. The bitfield incurred memory access is an aligned
memory access with alignment/size equal to the alignment of the
structure. This also simplified the code.
This may not be the optimal memory access in terms of memory access
width. But this should be okay since extracting the bitfield value will
have the same amount of work regardless of what kind of memory access
width.
Differential Revision: https://reviews.llvm.org/D69837
The file was modifiedllvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
The file was addedllvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
The file was addedllvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-2.ll
Commit 4264e7bbfdb30ed8fe1e0907bfa25e4d1bb04207 by Yaxun.Liu
[CUDA][HIP] Disable emitting llvm.linker.options in device compilation
The linker options (e.g. pragma detect_mismatch) are intended for host
compilation only, therefore disable it for device compilation.
Differential Revision: https://reviews.llvm.org/D57829
The file was addedclang/test/CodeGenCUDA/ms-linker-options.cu
The file was addedclang/test/Driver/hip-autolink.hip
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
Commit 0aba69eb1a01c44185009f50cc633e3c648e9950 by Devin Coughlin
[analyzer] Add test directory for scan-build.
The static analyzer's scan-build script is critical infrastructure but
is not well tested. To start to address this, add a new test directory
under tests/Analysis for scan-build lit tests and seed it with several
tests. The goal is that future scan-build changes will be accompanied by
corresponding tests.
Differential Revision: https://reviews.llvm.org/D69781
The file was addedclang/test/Analysis/scan-build/html_output.test
The file was addedclang/test/Analysis/scan-build/Inputs/multidirectory_project/directory1/file1.c
The file was addedclang/test/Analysis/scan-build/help.test
The file was addedclang/test/Analysis/scan-build/plist_output.test
The file was addedclang/test/Analysis/scan-build/plist_html_output.test
The file was addedclang/test/Analysis/scan-build/Inputs/single_null_dereference.c
The file was addedclang/test/Analysis/scan-build/exclude_directories.test
The file was modifiedclang/test/lit.cfg.py
The file was modifiedllvm/utils/lit/lit/llvm/config.py
The file was addedclang/test/Analysis/scan-build/Inputs/multidirectory_project/directory2/file2.c