[CIR] Emit comdat for weak global temporaries (#206530)
A lifetime-extended temporary with static or thread storage takes its
extending variable's linkage. When that linkage is weak-for-linker -- an
inline variable or a variable template binding a const reference to a
temporary -- and the target supports COMDAT, classic CodeGen puts the
temporary's global in a comdat. CIRGen's getAddrOfGlobalTemporary hit
errorNYI for that case, so `inline const int &r = 42;` failed to compile
under -fclangir. It is a recurring blocker in the libcxx std/ suite
(flat_map/flat_set construction, vector<bool>, format ranges).
CIR globals already carry a comdat flag, and the weak-for-linker path
elsewhere in CIRGenModule already sets it; this does the same for the
materialized temporary. The existing comdat lowering emits the symbol-named
`comdat any`, so the lowered IR matches classic byte-for-byte.
[AArch64][llvm-jitlink] Fix two QNX cross-compile build failures (NFC) (#206290)
Fixes two build failures when cross-compiling LLVM for QNX
(aarch64-unknown-nto-qnx8.0.0).
gcc `-Wstringop-overread` false-positive in `AArch64InstructionSelector.cpp`:
GCC's static analysis misreads the SmallVector fill constructor in
`selectUnmergeValues()` as potentially reading `NumInsertRegs *
sizeof(Register)`
bytes from the 16-byte inline buffer of `SmallVector<Register, 4>`,
emitting:
```
warning: reading between 20 and 17179869180 bytes from a region of size 16 [-Wstringop-overread]
```
Replacing the constructor-then-move with `assign()` fills the already-live object in place,
which GCC can analyze correctly.
[6 lines not shown]
[Arch][X86] Raising FreeBSD low requirement to pentium4 (#183554)
Using pentium4 by default allows us to build 32bit compiler-rt.builtins
on x86_64 platform since _Float16 requires SSE2, which is only available
after pentium3. Since FreeBSD does not support x86 after 16-CURRENT. It
makes sense to put the x86_64 compatibility first.
In FreeBSD's base, we set the target to i686 with -sse2 to build 32bit
compiler-rt.builtins. But we don't ship x86 compiler-rt.builtins in our
llvm port.
[flang][OpenMP] Use utility functions to get things from OmpObject (#206066)
Instead of using std::get_if or parser::Unwrap, use utility functions.
This also adds two additional functions: GetLocatorFromObj and
GetCommonBlockFromObj.
[Lanai] Mark as verifier clean
Now that we have fixes for verifier failures on all the in-tree tests,
we can mark Lanai as verifier clean.
Reviewers: jpienaar
Pull Request: https://github.com/llvm/llvm-project/pull/206202
[Lanai] Add test coverage for NewPM
Just duplicate all the RUN lines to additionally call llc with the NewPM
given there are only a handful of tests.
Reviewers: jpienaar
Pull Request: https://github.com/llvm/llvm-project/pull/206200
[CIR] Honor Direct coercion offset in callconv
A Direct classification with a coerced type assumed the coerced value
started at byte 0 of the original aggregate. On x86-64 SysV a 16-byte
record whose low eightbyte is NO_CLASS carries its live value in the high
eightbyte and is classified as getDirect(coerceType, offset=8); the
coercion path read and wrote the wrong eightbyte for that shape.
Add a directOffset to ArgClassification (with a getDirect(coerced, offset)
overload). emitCoercionToMemory now applies the offset to the coerced
(scalar) side of the slot via a u8 ptr_stride before the typed view, so the
aggregate side stays at offset 0 while the scalar is read from / written to
the right bytes. The offset is threaded through both emitCoercion overloads,
insertReturnCoercion, and the call-site and entry-block Direct arms. Offset
0 takes the original plain-bitcast path and is byte-identical to before.
The Test target parser gains an optional direct_offset key so cir-opt can
inject this classification; coerce-direct-offset.cir covers the offset-8
return and argument plus an offset-0 negative case.
[Lanai] BRCC should not set isBarrier
BRCC allows fall through, so we need to set isBarrier = 0, otherwise we
get machine verifier failures.
Co-Authored-By: Jacques Pienaar <jpienaar at google.com>
Reviewers: jpienaar
Pull Request: https://github.com/llvm/llvm-project/pull/206195