[Clang][Sema] Accept weak reference after declaration (#228809)
GCC accepts a weak reference even after there is a declaration. In here,
we use Check*Decl to do the required check and merge the NewDecl to
declaration chain.
Assisted-by: Claude # Tests ReleaseNote
Fixes: #56760
[InstCombine] Respect input denormal mode when folding ldexp (#247219)
InstCombine folds `ldexp(x, K)` into `fmul x, 2^K`. When `2^K` is
subnormal and the function's input denormal mode is not IEEE, the
multiply flushes the constant to zero so the result becomes zero instead
of the correctly scaled value.
We'd skip the fold in that case. The fold is unchanged under the default
IEEE mode and for normal scale factors.
Fixes #238186.
[clang] Do not use atomicrmw for compound assignment to a bool enumeration (#245856)
Fixes #245854.
`EmitCompoundAssignLValue()` allows `atomicrmw` for integer-like types
that are
not `_Bool`, so an enumeration with a fixed bool underlying type is
updated as a
plain integer and never renormalized to the bool representation:
```c
_Atomic enum E : bool { F, T } b;
b += 2; /* gives 0 at -O2, expected 1 (both are 1 at -O0) */
```
The IR is `atomicrmw add i8 2`, which leaves the object representation
as 2.
`b |= 2` is affected in the same way.
[6 lines not shown]
[lld][ELF][SPARC] Use the PLT for R_SPARC_WDISP30 calls (#246805)
Non-PIC code uses R_SPARC_WDISP30 for a call. It was handled as a plain
PC-relative reference, so a call to a function in a shared object got a
canonical PLT entry, a call to a protected function failed with "cannot
preempt symbol", and -shared rejected the call.
Handle R_SPARC_WDISP30 like R_SPARC_WPLT30. R_SPARC_WDISP30 is only used
by call, which never takes the function's address, so a non-canonical
PLT entry is enough.
This differs from GNU ld on purpose. GNU ld gives such functions
canonical PLT entries in an executable, and with -shared it emits
dynamic R_SPARC_WDISP30 relocations, which need DT_TEXTREL.
Assisted-by: Claude
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang][bytecode] Split up registering locals (#247160)
Split it into allocating the local and registering it in the
`VariableScope`. In the future, we will need to know if evaluating the
initializer failed before registering the local.
[mlir][vector] Do not fold contiguous gather/scatter on non-unit strides (#241601)
`FoldContiguousGather` and `FoldContiguousScatter` rewrite a
gather/scatter with indices `[0, 1, ...]` into
`vector.maskedload`/`vector.maskedstore` without checking the memref
layout. When the most minor memref dim has a non-unit stride, the result
fails verification.
This patch skips the fold unless `vector::isValidLoadStoreMemRefLayout`
(added in #241579) accepts the layout, so single-element gathers still
fold.
Fixes #240189
Assisted-by: Claude Opus 5.5
[NFC][Clang][Driver] Simplify return path slicing in addCompDirArg (#247431)
Since CC1Flag is now a parameter, assert that it ends with '=' and
offset by CC1Flag.size() instead of scanning for '='.
Follow-up to #247135.