[Flang] [OpenMP] [MLIR] Add lowering support for OMP ALLOCATE directives and its clauses (#187167)
This patch implementation is primarily focused on
- Lowering to LLVM IR, by generating appropriate kmpc_alloc() and kmpc_alligned_alloc() calls for variable(s) and before the end of scope generating kmpc_free() for the same variable(s).
- Also handled, usage of array variables in the OMP ALLOCATE directive.
- Define omp.allocate_free operation in MLIR and slight changes to existing MLIR definition of ALLOCATOR clause.
- Add test cases for variations of usage of OMP ALLOCATE directive and its clauses ALIGN and ALLOCATOR.
[IR] treat nofpclass as a poison-generating return attribute (#192016)
- For: #191338
Failing nofpclass attribute will generate poison.
This change adds nofpclass attributes to
`hasPoisonGeneratingReturnAttributes`/`dropPoisonGeneratingReturnAttributes`.
[CIR] Implement __builtin_verbose_trap (#191935)
Route BI__builtin_verbose_trap to the existing emitTrap() path so that
it no longer hits the NYI fallback. Debug info message attachment from
the string arguments is not yet implemented (tracked by
MissingFeatures::generateDebugInfo).
This is the single largest NYI category in libcxx testing, unblocking
~1,008 test failures.
[RISCV] Prevent emitting vsetvli with e32alt or e64alt. (#191960)
The e32alt and e64alt encodings for vtype are reserved.
Non-fp instructions ignore altfmt and we want to use that to avoid
vtype toggle when using load, store, slide, gather, etc. to manipulate
bf16 vectors. This is why we have a Demanded bit for AltFmt.
We need to make sure we don't keep the AltFmt set when we're changing
SEW to 32 or 64.
A new isValidVType function has been added to help catch illegal
vtype earlier.
[lldb] Replace remaining uses of `UnwindLogMsg()` with UNWIND_LOG macro (#192038)
This mostly replaces `"0x%" PRIx64` with `"{:x}"`, but also replaces
'%d' (used for register / scheme numbers and CFA offsets) and '%s' with
simple `{}`, removing the now redundant casts and calls to
`GetCString()` / `AsCString()`.
`UnwindLogMsg()` is no longer used and has been removed.
[CIR] Add noundef to memchr declaration and call sites (#191457)
The memchr LLVM declaration created by MemChrOp lowering had no
arg_attrs, so the lowered IR was missing `noundef` on all three
parameters. OGCG emits `noundef` on them.
Adds `noundef` to both the `@memchr` declaration and each
`call @memchr` instruction.
Made with [Cursor](https://cursor.com)
[CIR] Fix union RecordType::getTypeSizeInBits to return bits (#191516)
RecordType::getTypeSizeInBits for unions was calling
dataLayout.getTypeSize (which returns bytes) instead of
dataLayout.getTypeSizeInBits. This returned a value 8x too
small. Also handle the empty-union case where
getLargestMember returns nullptr.
[mlir][quant] Print actual quant storage type when signed (#187300)
Without the fix, bytecode serialization roundtrip breaks for types that
don't have custom bytecode serializers and contain quant types, since
the fallback mechanism prints the type and the quant printer coerces
signed to signless types. E.g. `!custom<!quant.uniform<ui8:f32, 0.1>>`
will print as `u8` when serializing and later be created as a signless
`i8` when deserializing.
[NFCI][VPlan] Split initial mem-widening into a separate transformation (#182592)
Preparation change before implementing stride-multiversioning as a
VPlan-based transformation. Might help
https://github.com/llvm/llvm-project/pull/147297/ as well.
[libc][NFC] Fix GCC build in __futex_word.h (#192078)
Included __llvm-libc-common.h in __futex_word.h to fix a build failure
with GCC.
GCC in C++ mode does not recognize _Alignas without the mapping to
alignas provided in __llvm-libc-common.h.
The failure was introduced in commit 91c0fdfe1392.
[clang] Add support for SerenityOS (#187941)
Adds support for the $arch-unknown-serenity target to the Clang front
end. This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.
----
A first attempt at upstreaming this patch was made
[here](https://reviews.llvm.org/D154396). I hope I fixed everything
mentioned there.
I intentionally kept `/usr/local/` in the default lookup path. I
consider it the more practical option, and I’d prefer to have the patch
merged as is and revisit the FIXME later. If this is absolutely
unacceptable to the maintainers, I will happily drop it and keep it as a
local patch until we address the underlying issue.
[7 lines not shown]
[CIR] Disable CIR pipeline for LLVM IR inputs (#187729)
When -fclangir is passed and the input is LLVM IR (e.g. during the
backend phase of OpenMP offloading), the CIR frontend pipeline is not
applicable.
Co-authored-by: Claude Opus 4.6 <noreply at anthropic.com>
[InstCombine] Fold (X + C) + (Y & ~C) to X + (Y | C) (#191334)
Add an InstCombine fold for masked overwrite patterns where the add
constant matches the cleared bits in the mask:
(X + C) + (Y & ~C) -> X + (Y | C)
Since `Y & ~C` clears all bits set in C, adding C cannot generate carry
through those bits and is equivalent to setting them with `or`.
Proof: https://alive2.llvm.org/ce/z/277UFK
Fixed: https://github.com/llvm/llvm-project/issues/191171