[Clang] [MinGW] Handle `-nolibc` argument (#182062)
This implementation differs from GCC, but arguably more in line with
Unix systems, because it stops linking of default Win32 system
libraries.
On GCC it works like this:
```
❯ /ucrt64/bin/gcc -### /dev/null -nolibc 2>&1 | tr ' ' '\n' | rg '^\-l' | sort -u
-lgcc
-lgcc_eh
-lkernel32
-lmingw32
-lmingwex
-lmsvcrt
❯ /ucrt64/bin/gcc -### /dev/null 2>&1 | tr ' ' '\n' | rg '^\-l' | sort -u
-ladvapi32
-lgcc
[21 lines not shown]
[orc-rt] Add comment about Session::waitForShutdown usage. NFC. (#191111)
Add a warning not to call Session::waitFromShutdown from on-detach or
on-shutdown handlers.
[orc-rt] Add ScheduleShutdownFromOnDetachHandler unit test. (#191110)
This test checks that it's safe to call Session::shutdown from an
on-detach handler, and that:
1. The Session does proceed to shut down.
2. All on-detach handlers run before any on-shutdown handlers.
Revert "Fix missed 'else' in LVCodeViewReader and LVDWARFReader.cpp. " (#191109)
Reverts llvm/llvm-project#188578
It cause a test failure on multiple buildbots.
[compiler-rt] Enable sanitizers, XRay, etc for hexagon (#190300)
Enable additional compiler-rt components in the hexagon-linux-clangrt
standalone cache file.
Also set CAN_TARGET_hexagon=1 to bypass the try_compile() probe that
fails during cross-compilation, and configure SANITIZER_CXX_ABI to use
the in-tree libc++ to avoid link failures.
[llvm-debuginfo-analyzer] Fix missed 'else' in LVCodeViewReader and LVDWARFReader.cpp. (#188578)
Issues found PVS studio static analyzer. LVCodeViewReader.cpp. PR for #170117.
4. Potent UB: manipulation of invalid object.
The PVS-Studio warning: V519 The 'FeaturesValue' variable is assigned values twice successively.
Committed on behalf of @Seraphimt
[LLVMABI] Fix build for GCC < 8 (#190974)
`llvm::abi::ArgInfo::get*` functions return `llvm::abi::ArgInfo` by
value, so we need the type to be copyable. It is not though, because of
the non trivially copyable member `MaybeAlign` (`std::optional<Align>`)
in a union, which deletes the implicit copy/move constructors and
assignment operators.
For modern GCC versions and for clang this does not present as a problem
due to named return value optimization (NRVO). It is however not a bug
in old GCC versions, because NRVO is not guaranteed. Similary
`std::optional`
could be trivially copyable, but that is also not guaranteed by the
standard.
Instead of depending on these details of the C++ implementation, move
the `MaybeAlign` member out of the union, and make it a separate member
of `abi::ArgInfo`. We lose the expressiveness from the type system that
`IndirectAttrInfo` always has a defined alignment, but we can get that
back in practice by placing asserts in the code that uses it. Therefore
[2 lines not shown]
[LSAN] Add extra suppressions on Apple Aarch64 (#117478)
- _fetchInitializingClassList for startup code in dyld.
- dyld4::RuntimeState::_instantiateTLVs for thread locals.
Fixes https://github.com/llvm/llvm-project/issues/115992, now it shows
the following instead (in a project using thread locals):
```
-----------------------------------------------------
Suppressions used:
count bytes template
3 120 *_fetchInitializingClassList*
1 104 *dyld4::RuntimeState::_instantiateTLVs*
-----------------------------------------------------
```
[AArch64][CodeGen] match (or x (not y)) to generate mov+orn (#190769)
Fixes: https://github.com/llvm/llvm-project/issues/100045
Adds AddedComplexity to increase the priority the pattern that matches
(or x (not y)) and generates a mov+orn instead of the original mvn+orr.
The number of instructions still stay the same but mov+orn can be
considered better than mvn+orr for two reasons:
1. Symmetry: For the same input with an 'and' instead of 'or', mov+bic
is generated.
2. Optimzation through register rename: If mov is immediate (for
example, 'mov x1, #0x4'), it can be retired early by the register
renamer and never issued for execution.
[compiler-rt] fix __sanitizer::struct_sock_fprog_sz availability (#183411)
`struct sock_fprog` is not provided by glibc, but rather by the linux
headers (`#include <linux/filter.h`). It seems that glibc due to an
implementation detail internally includes `<linux/filter.h>` somewhere
other C libs (e.g. musl) do not, which previously caused build failures
and let to disabling `struct sock_fprog` on non-glibc Linux systems.
This adds the missing include and provides it again for all Linux
systems regardless of C lib.
[RISCV][NFC] Improve Musttail Comments/Tests (#191093)
In the Target code, this is mostly fixing typos or other comment issues.
In the musttail.ll test, this ensures the tests are more aligned with
their comments, and that the comments are accurate. I inserted some
inline asm clobbers so it's also easier to see what's going on.
[clang][ssaf] Add `JSONFormat` support for `WPASuite` (#191082)
This patch adds `JSONFormat` serialization support for `WPASuite`.
- Adds `readWPASuite` / `writeWPASuite` to the `SerializationFormat`
abstract interface and implements them in `JSONFormat`.
- Introduces `AnalysisResultRegistryGenerator`, a per-format plugin
registry template in `SerializationFormat`, allowing analysis authors to
register (de)serializers for their `AnalysisResult` subtypes with a
single static declaration.
- Extends `PrivateFieldNames.def` with `WPASuite::Data` and
`WPASuite::IdTable`, and adds a `makeWPASuite()` factory to
`SerializationFormat`, so deserialization code can construct a
`WPASuite` incrementally through the same access-controlled pattern used
for all other SSAF data structures.
[TargetLowering] Add support for more constants to expandDIVREMByConstant. (#189286)
If we can find a chunk size k where 2^k mod divisor == -1, we can add
the even chunks and subtract the odd chunks. The resulting sum may be
negative, so we need to add 2^k + 1 (a multiple of divisor) for each odd
chunk to ensure the result is positive. We have enough extra bits
between the chunk size and HBitWidth to avoid overflow.
The idea here is similar to checking if a decimal number is divisible by
11. You can add the even digits and subtract the odd digits. If the
resulting sum is divisible by 11 the original number is divisible by 11.
[RISCV] Remove NoVendorXMIPSCBOP from the Zicbop instructions. (#191015)
The XMIPSCBOP encodings use OP-CUSTOM-0 so there's no encoding overlap
here. Presence of a vendor extension should not disable parsing or
disassembly of a standard extension that doesn't overlap.
[Clang][NFC] tests showcasing incorrect use of HIP and OpenCL memory scope macros (#188890)
The tests demonstrate how incorrect LLVM IR is generated without
diagnostics, when an OpenCL or HIP scope number is passed to an AMDGPU
intrinsic. #185408 lays the groundwork for properly diagnosing this
situation by internally using a separate enum type to represent each set
of scope numbers.