[clang] Add test for CWG 2006 and update status (#215259)
Clang already supports CWG 2006. Adding test cases and updating
`cxx_dr_status.html` to 2.7.
https://cplusplus.github.io/CWG/issues/2006.html
Assisted by Claude.
workflows/release-binaries: Install Wix on Windows ARM64 (#217707)
Wix is used for generating the installer and is not installed by default
on Windows ARM64.
(cherry picked from commit f75f48e3ce41227c5a0ae5d2c6d6ea90100b9bc4)
workflows: Merge release-doxygen into release-documenation (#214366)
These two workflows use the same script and have the same structure,
so it's easier just to have one job that builds both.
(cherry picked from commit 2d47daa636204868874ce88e55992b096904411e)
[clang-tidy] Fix crashes when analyzing unknown exceptions in bugprone-exception-escape (#218067)
`ExceptionAnalyzer` represents exceptions of unknown type with a null
`Type`, but some consumers dereferenced it unconditionally, resulting in
a crash when `TreatFunctionsWithoutSpecificationAsThrowing` is enabled.
This commit fixes the problem by skipping type-dependent processing for
unknown exceptions.
Fixes #217649
(cherry picked from commit c0feba8bedbfda4f1a2f3727f2ef270fcc6ca138)
[RISCV] Use correct type for (u)int64_t in RVV intrinsics on OpenBSD (#217211)
The intrinsics are documented to use (u)int64_t for 64-bit scalars.
OpenBSD on RV64 uses long long for int64_t while Linux uses long. The
current code finds the first 64 bit type which is long for both OpenBSD
and Linux.
This patch looks up the type that corresponds to (u)int64_t.
Fixes #216531.
Assisted-by: Claude
(cherry picked from commit fd6d7a608909dc4ecea57e0155042d16f7b4e61a)
[clang][win] Fix __global_delete breaking __attribute__((used)) (#217753)
The `__empty_global_delete` fallback introduced in #209585 was marked
used via `llvm::appendToUsed()`, which creates a global named
"llvm.used" during codegen. `CodeGenModule::emitLLVMUsed()` later
unconditionally creates its own global of that same name at end-of-TU,
so the name collision renamed the latter to "llvm.used.1" -- a name LLVM
ignores. The result was that every `__attribute__((used))` global in the
TU silently lost its used semantics whenever a `__global_delete` wrapper
was emitted, letting those symbols be dropped.
Mark the fallback used via `CodeGenModule::addUsedGlobal()` instead, so
it joins the single llvm.used that `emitLLVMUsed()` emits.
`emitLLVMUsed()` runs well after `emitGlobalDeleteForwardingBodies()` in
`Release()`, so the fallback is still recorded in time.
Fixes a regression reported on #209585.
(cherry picked from commit 061865f32607cd064ab944407cc863186702d6f1)
[Mips] Legalize vector UNDEF instead of expanding to zero BUILD_VECTOR (#211503)
Currently, MIPS MSA expands ISD::UNDEF into a BUILD_VECTOR of all zeros
during legalization. This creates an infinite loop in DAGCombiner when
the following occurs:
1.Mips lower BUILD_VECTOR expands non-splat vectors into
INSERT_VECTOR_ELT with creating undef node
2.Then legalization expands UNDEF back to BUILD_VECTOR zero
3.Mips lower BUILD_VECTOR converts zero vector to BITCAST
4.DAGCombiner optimizes BITCAST(zero) to UNDEF
5.Back to step 2, infinite loop
Fix #210229.
(cherry picked from commit b1c24ea77d2aab84f9e8ccb9389bc4366c41e8dd)
[AMDGPU] Simplify immediate checking and cleanup in omod folding. NFC (#218217)
The key changes are:
1. Replace std::pair() with brace initialization {}
2. Simplify immediate operand detection: Instead of checking both Src0
and Src1 to find which one is immediate, we now use
getImmOrMaterializedImm on Src1 directly, since after canonicalization
the immediate is always in Src1.
3. Extract the register into a variable (OModSrcReg) for better
readability
The new tests cover cases where the immediate appears first in the IR
(e.g., 4.0 * %add), which after DAG canonicalization becomes (%add *
4.0), ensuring the immediate is always in the second operand position.
These tests verify that omod folding works correctly after
canonicalization.
No functional change intended.
[IR] Remove deprecated Instruction*-based insertBefore/moveBefore overloads (#218234)
Remove the deprecated Instruction::insertBefore(Instruction*),
moveBefore(Instruction*), and moveBeforePreserving(Instruction*)
overloads in favour of the iterator-accepting overloads.
Co-authored-by: Claude <noreply at anthropic.com>
[libc][math] Integer-only, statically rounded implementation of expf (#209406)
Integer-only, statically rounded implementation of `expf`, using 1
single `Frac64`-based pipeline
# Accuracy
All unit, smoke, and exhaustive tests against
`LIBC_NAMESPACE::shared::expf` pass for all rounding modes.
# Code size:
> [!NOTE]
> The report below are from the`armv8m.main-none-eabi` triple.
## Before the patch
```sh
$ ls -lB libc/src/math/generic/CMakeFiles/libc.src.math.generic.expf.dir/
[68 lines not shown]
[ConstraintElim] Bound non-increasing header IVs by start value. (#217921)
Generalize addLowerBoundsForHeaderInductions to also support bounding
decrementing IVs: if the IV gets decremented w/o wapping in the signed
sense, it will never exceed the start value and we can add PN s<=
StartValue.
This helps to remove a number of branches in real-world workloads:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/984
Note that in a few instances (found 2), the removed branches result in
flags dropped. We should be able to recover those (and more) by using
info from ConstrantElimination to strengthen flags.
Alive2 Proof: https://alive2.llvm.org/ce/z/7t_xHX
PR: https://github.com/llvm/llvm-project/pull/217921
[libunwind] Make Apple OS version XFAILs robust to patch-level versions (#218125)
We are seeing some failures since some of the Apple CI runners have been
updated to 26.5.2. That was caused by the regular expressions not
matching patch level version bumps.
[EarlyIfConversion] Extend data dependent analysis across multiple blocks (#180623)
This extends the new data dependent analysis for branches to cover loads
which feed conditions which are not within the same Machine Basic Block.
To still try to catch loads which are "close in program time" we
limit on the number of instructions between the branch and the
load. We also bail out if we detect a function call or loop between the two
instructions.
[mlir][SCF] Skip dynamic peeling for non-index loops (#217909)
`scf-for-loop-peeling` constructs an `affine.apply` on its dynamic path
to compute the split bound. However, `affine.apply` requires `index`
operands, while `scf.for` also permits signless integer induction
variables and bounds.
Skip the dynamic peeling path when the loop induction variable is not
`index`. The existing constant-bounds path remains unchanged, so
constant integer loops can still be peeled.
Add a regression test for a loop with dynamic `i32` bounds, verifying
that the pass leaves it unchanged rather than producing invalid IR.
Fixes #216631.
Co-authored-by: Purnima Shrivastava <purnimashrivastava05@.com>
[mlir][scf] Do not read non-constant loop bounds when unrolling (#217392)
`loopUnrollByFactor` asserts `expected constant loop bound`
(`SCF/Utils/Utils.cpp`) when the loop bounds are not constant.
`getStaticTripCount` takes the constant path whenever
`constantTripCount` answers, but `constantTripCount` answers on three
shapes where the bounds themselves are **not** constant:
- `lb == ub` (same `Value`), giving 0 iterations,
- `lb == 0` and `ub == step`, giving 1 iteration,
- `ub` a constant offset from a non-constant `lb`, via
`computeUbMinusLb` under `nsw`.
In all three the code then reads the bounds as constants and asserts.
The fix takes the constant path only when `lb`, `ub` and `step` are all
constant, and otherwise falls through to the dynamic path that already
handles them. The other two callers of `getStaticTripCount` in that file
use only the count, never the bounds, so the defect is confined to this
[4 lines not shown]