[VPlan] Narrow truncates of an induction plus a loop-invariant offset (#226035)
narrowInductionTruncates replaces trunc(iv) by an induction in the
truncated type, but bails out when the truncate operand is the induction
plus an offset, such as the induction increment.
Handle a loop-invariant offset C by folding it into the start value of
the narrowed induction, computed once in the vector preheader, which
covers both trunc(iv + C) and trunc(iv - C). The offset does not have to
be the induction step, as start + C + i * step stays affine for any
loop-invariant C, and trunc(x + C) agrees with trunc(x) + trunc(C)
modulo the truncated width. When the epilogue is vectorized, the resume
value of the narrowed induction is adjusted by the same offset.
On targets where wide i64 vector arithmetic is expensive, this can
decide whether the loop is vectorized at all.
[OpenMP] Build libomp on 32-bit PowerPC Linux (#227539)
kmp_affinity.h has no `sched_{set,get}affinity` syscall numbers for
32-bit PowerPC and stops at its #error. They are the same as on ppc64
(222 and 223), so share that case.
32-bit PowerPC has no 64-bit atomic instructions, so linking libomp.so
also fails on undefined `__atomic_*_8` references. Link libatomic, as
for MIPS, but only if it exists: other 32-bit PowerPC targets such as
OpenBSD (52a02b6d1e0c) may not have it. AIX already links libcompiler_rt
for these.
Assisted-by: Claude Code
[TTI][SLP] Pass the scalars of the lanes to getArithmeticInstrCost
SLP prices a vector instruction with one scalar lane as the context. A
target that reads a property of the context, like the users of an fmul
that fuses into an fma, gives the whole vector the property of that lane.
Add the scalars of the lanes to getArithmeticInstrCost, like
getAltInstrCost does, and pass them from SLP. AMDGPU uses them for the
fmul fusion and the fdiv afn costs: the vector gets the cheaper cost only
if all lanes qualify.
Assisted-by: Claude Opus
Revert "[RISCV] Make clang's -mcpu=help and -mtune=help accurate for RISC-V. (#243697)" (#244534)
This reverts commit 6a92538ef2a7103e62e66e490f5d2aafa354b767, which
broke check-flang because -mtune=help was changed to alias a new option
handled only in Clang's frontend, whereas Flang's frontend still checks
only the original option:
FAIL: Flang :: Driver/print-supported-cpus.f90
The failure log is at
https://github.com/llvm/llvm-project/actions/runs/44690702871/job/136135570988
Assisted-by: Antigravity
[libc++] Avoid copying locales throughout the library (#242392)
The normal `getloc()` returns a `locale` by value, which forces a copy
constructor and destructor call (for reference counting) in a lot of
places where we really just need to access the locale. This introduces a
private `__getloc()` to access the locale by reference, saving these
calls.