[InstCombine] Create new instructions instead of in-place operand replacement (#115988)
Fixes https://github.com/llvm/llvm-project/issues/115890.
Currently it doesn't affect final codegen. But we may suffer from this
problem when we utilize these attributes for further optimization (e.g.,
https://github.com/llvm/llvm-project/pull/111284). This test case is
reduced from a csmith-generated C program. And I believe this problem
also exists in real-world programs.
[SmallPtrSet] Optimize Grow and inline FindBucketFor. NFC (#206304)
During rehashing every key is known absent, so skip the equal-key
comparison.
DenseMap got a similar optimization in #200595
FindBucketFor is then only used by insert_imp_big; inline its probe loop
there. The loop takes 7 inst instead of 9 in the clang-generated
assembly after removing the two `LLVM_LIKELY`.
[LV] Add test with pointer based on SRem expression (NFC). (#206344)
Add a test with loads and stores with pointers based on a signed
remainder (srem) of a non-negative induction variable, mirroring the
existing urem test.
[SLP][NFC] Avoid undef usage in odd_store.ll (#206333)
Replace `ret i32 undef` with void return type to avoid CI undef
deprecator failures.
For this PR: https://github.com/llvm/llvm-project/pull/206259
[clang] builtins for atomicrmw fminmax/_num (#187139)
Adds compiler builtins for `atomicrmw`: `fminimum`, `fmaximum`,
`fminimum_num`, `fmaximum_num`.
These will be used by the corresponding libc++ atomic apis (see #186716).
[libc][test] Build LibcFPTestHelpers in full-build mode
In a full build the unit framework is built in overlay mode while the tests
use LIBC_FULL_BUILD, so FEnvSafeTest's fenv_t member differs in size (16 vs
8 bytes on Darwin) -- an ODR violation that crashes math smoke tests. Add a
UNIT_AS_FULL_BUILD opt-in and use it for the hermetic LibcFPTestHelpers.
[libc][math] Fix aarch64 Darwin fenv implementation for full builds
A full build replaces the system (Apple) <fenv.h> with libc's headers, so
fenv_darwin_impl.h no longer found an 8-byte fenv_t, FE_FLUSHTOZERO, or the
__fpcr_* masks it relied on. Size FPState to the fenv_t in scope, alias
FE_FLUSHTOZERO to FE_DENORM, and define the FPCR trap masks locally.
[libc][math] Extend iscanonical macro to _Float16 and float128
iscanonical is a C23 type-generic macro, so the f16/f128 variants are
surfaced through it rather than as functions in the generated math.h.
float128 is only listed when distinct from long double (LDBL_MANT_DIG !=
113) to avoid two _Generic associations with compatible types.
[libc++][test] Drop _BitInt(96) byteswap padding check on 32-bit x86 (#205295)
`byteswap.verify.cpp` (added in #203876) expects `std::byteswap(unsigned
_BitInt(96))` to be rejected for having padding bits. That holds on
x86_64, where the type is 16 bytes with 32 padding bits, but not on
32-bit x86: the i386 psABI aligns `_BitInt` to 4 bytes and packs
`_BitInt(96)` into 12 bytes with no padding, so the call is well-formed
and the expected diagnostic never fires. The Android i386 builder caught
this.
Gate `test_unsigned_96` on `!defined(__i386__)`. Every other target,
including 32-bit arm, riscv32, ppc32, mips32 and sparc32, gives
`_BitInt(96)` 16 bytes with padding, so the case still exercises the
padding-bit Mandate everywhere except 32-bit x86. `sizeof` is not
available to the preprocessor, so the guard is a target check rather
than a direct has-padding predicate.
Assisted-by: Claude (Anthropic)
[2 lines not shown]
[clang-tidy] Move part of bugprone-unhandled-code-paths to a new check readability-trivial-switch (#198237)
The moved part detects trivial `switch` statement which can be removed
or rewritted as `if` statement.
hicpp-multiway-paths-covered was removed without keeping its name as
alias, so we don't need to update infrastructore to support one-to-many
aliases.
Changes were generated by AI, and reviewed and modified by me
afterwards.
Assisted-by: GPT-5.5
[clang] Replace Sema::OffsetOfComponent with Designation (#199097)
The parser previously fed __builtin_offsetof through a small ad-hoc
struct (Sema::OffsetOfComponent) that mirrors the same path data already
modeled by Designation/Designator. With the recent code-completion work,
the parser was building both shapes side by side.
Drop OffsetOfComponent. ActOnBuiltinOffsetOf, BuildBuiltinOffsetOf, and
TreeTransform::RebuildOffsetOfExpr now take a const Designation &.
- Parser: stops maintaining the parallel Comps vector and feeds the
Designation it already collected for completion straight to Sema.
- BuildBuiltinOffsetOf: iterates over the Designation.
- TreeTransform: rebuilds a Designation from each OffsetOfNode. The AST
node already encodes "leading-dot collapsed to name location" via its
Range constructor, so we mirror that by passing an empty DotLoc whenever
the new Designation is still empty.
- OffsetOfNode: tighten the identifier constructor and getFieldName
accessor to const IdentifierInfo*, matching Designator's accessor and
[9 lines not shown]
[InstSimplify] Fold splice.right(splice.left(poison, x, offset), poison, offset) -> x (#204256)
Fixes #203027
Adds an InstSimplify fold for
llvm.vector.splice.left/m.vector.splice.right roundtrip. The values in a
vector are first shifted to the right and then to the left, filling the
clipped off values with poison. In this scenario, the shift operations
get simplified to just x.
[llvm-readobj][NFC] Use compact enum for ELFDumper (#206306)
This is the last user of EnumEntry. Migrate to compact enums to avoid
relocations for faster startup and reduced binary size.
[Support] Make format_object non-virtual (#206319)
Currently, format_object creates a 32B vtable for every instantiation.
This is costs space and dynamic relocations. Make format_object
non-virtual and adapt the two printing users to use a function_ref
instead.