[libc++] Simplify the implementation of __is_reference_wrapper (#245963)
This avoids a few class template instantiations, reducing compile times
a bit.
[LowerAtomic] Preserve alignment when lowering atomicrmw (#246171)
lowerAtomicRMWInst created the load and store that replace an atomicrmw
with the ABI alignment of the type instead of the atomicrmw's alignment.
For example, NVPTXAtomicLower turns an i32 atomicrmw with align 2 on
local memory into a misaligned `ld.local.b32`/`st.local.b32`, which
faults on the GPU. lowerAtomicCmpXchgInst already uses the instruction's
alignment.
The first commit adds the tests with the current output.
Assisted-by: Claude Code (Claude Opus 5.5)
[ValueTracking][NFC] Prepare computeKnownFPClass before moving it to ValueTrackingFP.cpp (#244967)
Changes:
- `getShuffleDemandedElts`, `breakSelfRecursivePHI` and will be used by
both `ValueTracking.cpp` and `ValueTrackingFP.cpp`
- Moves `getShuffleDemandedElts` into `VectorUtils.cpp`
- `computeKnownFPClass` now call a public `computeKnownBits` overload
instead of a static/private overload. This change is NFC.
AI Disclosure:
I used Claude Opus 5.5 to help with the code changes.
[libc++] Remove _LIBCPP_HIDE_FROM_ABI from the private headers (#245965)
This is the fifth bulk-removal patch of `_LIBCPP_HIDE_FROM_ABI`. While
this is something we could do over time, actively removing the redundant
annotations significantly improves readability, and QoI.
This happens in a few patches to keep the size somewhat manageable.
[ARM][NFC] Add tests for bf16 vector calling convention (#242825)
In preparation for
- https://github.com/llvm/llvm-project/pull/224867
Pin down the calling convention for bf16 on arm, especially when `bf16`
is not available natively and the fallback mechanism is used.
I've also included a test that PR adds that on other targets caught a
bug with how bf16 was handled. Arm gets it right already, but we may as
well test for it explicitly.
[flang][acc] Scalarize firstprivate array descriptors. (#246157)
Extend ACCOptimizeFirstprivateMap to scalarize read-only, known-rank
array descriptors. Read lower bounds, extents, and byte strides before
the offload region and rebuild the descriptor with fir.create_box inside
it. Use a null base when consumers do not require the base address;
otherwise, retain the original descriptor load to extract the device
base. Add tests for both cases to the existing pass test.
Assisted-by: Codex
[SLP] Use costing to decide between Strided Loads and Compressed Loads (#235944)
For small vectors with small strides, the vectorized load can be
represented as either a stride or a masked compress. Rather than
preferentially choose compression, decide based on the relative costs.
Relands #226540.
[GlobalISel] Preserve cache hint metadata through IRTranslator (#224522)
Preserve cache hint metadata when lowering from IR to gMIR. Supports
loads/stores atomic loads/stores, atomicrmw, cmpxchg, memcpy, memmov,
and memset and target memory intrinsics.
[SampleProfile] Match stale profiles inside eliminated inline frames
An inline frame can survive after its standalone Function is deleted.
Recovering its root profile is not enough when probe locations inside that
frame have changed: the existing matcher visits surviving functions and
otherwise represents inlined code through the outermost call site.
Collect frame-relative anchors during the existing instruction scan and
match eliminated functions with the existing stale-profile matching algorithm.
Prefer a surviving definition when one exists, require an available mismatched
probe descriptor for probe-based matching, and resolve known MD5 callee names
before the matching loop.
Share selective inline-root retrieval with the matcher, including cases where
caller locations disagree or the outer function has no root profile. Permit
annotation of a known checksum mismatch only when a location map is available;
retain the definition and call-count checks for sample reuse.
This is the stale-location extension split from the basic profile-recovery
[5 lines not shown]
[SampleProfile] Split stale inline-frame matching into a follow-up
Keep the basic inline-profile recovery in #245375 and move the stale-location
extension into a separate stacked change. Preserve selective root discovery,
nested-profile preference, missing-outer-frame handling, and the definition,
call-count, zero-head, and available-checksum checks.
Restore the existing stale-profile matcher, remove matching-only retrieval
policy and location-map accessors, and reject known checksum mismatches in
root fallback. Move the synthetic moved-probe tests with the extension while
retaining the basic recovery and negative checksum tests.
This commit is directly on top of 76cd07eceb984b3c248387a1c8f6ee0e891e7343,
so the published recovery commit does not need to be rewritten. The stacked
follow-up restores the original combined source tree exactly.
Assisted-by: OpenAI
[CIR] Support ConstantExpr GLValues and subexpression fallback in ScalarExprEmitter (#242234)
### Description
This patch adds support for `ConstantExpr` GLValues and subexpression
fallback in `ScalarExprEmitter::VisitConstantExpr`, establishing parity
with classic Clang CodeGen
(`clang/lib/CodeGen/CGExprScalar.cpp:516-530`).
In ClangIR, evaluating a `ConstantExpr` GLValue in an RValue scalar
context (such as returning or loading a scalar from a `consteval`
function returning a reference: `int test_load() { return get_ref(val);
}`) previously caused `errorNYI: ScalarExprEmitter: constant expr GL
Value`, while a null result from `tryEmitConstantExpr` failed with
`errorNYI: ScalarExprEmitter: constant expr` rather than delegating to
the subexpression.
This change:
1. Creates the pointee LValue via `makeNaturalAlignPointeeAddrLValue`
[12 lines not shown]
[TBAA] Preserve tags when an access ends within a field (#243670)
Allow `AAMDNodes::adjustForAccess `to derive a `!tbaa` tag when the
requested access ends inside a `!tbaa.struct field`. The correct check
for `adjustForAccess` is that if all struct fields in [0, accessSize)
carry the same scalar access tag, then you can derive that scalar access
tag for the whole sub-access. This doesn't change if the access ends
inside a field.
In the added test, an 8-byte `memcpy` copies a `long`. SROA splits this
into two 4-byte loads. The first 4-byte load previously did not receive
the `long` tag because it ended half-way through the `long`. The second
4-byte load did receive the `long` tag because the load is at a 4-byte
offset, so the `!tbaa.struct` metadata is first shifted 4 bytes so that
it looks like `!0 = !{i64 0, i64 4, !1}` and then the 4-byte access does
not end inside a field.
[SPIRV] Lower llvm.sincospi to OpenCL.std sinpi and cospi (#231761)
llvm.sincospi failed instruction selection for SPIR-V. It now lowers to
OpenCL.std sinpi and cospi, emitting only the results that are used and
typing them from the argument; shaders and types OpenCL.std does not
define for these instructions get a diagnostic.
Split out of #218641.
This PR was generated using AI
---------
Co-authored-by: Marcos Maronas <mmaronas at amd.com>