[lld-macho] Don't write chained fixups through misaligned pointers (#238485)
`DYLD_CHAINED_PTR_64` fixups only need to be 4-byte aligned, but later
patched their `next` fields, through pointers to
`dyld_chained_ptr_64_rebase` and `dyld_chained_ptr_64_bind`, which need
8-byte alignment. UBSan has flagged this since #234006 added a
4-byte-aligned fixup to chained-fixups-alignment.s.
Now we build them in locals and memcpy them in and out. arm64e fixups
have to be 8-byte aligned, so those writes are fine as they are. The
test now also has a bind and a `next` field at 4 mod 8, and checks that
the chain still decodes.
Fixes the sanitizer-x86_64-linux-fast failure after #234006:
https://lab.llvm.org/buildbot/#/builders/169/builds/28168
Assisted-by: Claude
Reapply "[SelectionDAG] Narrow (shr (sub A, B), 1) to AVGSUBFLOOR" (#238249) (#238408)
Needed to regenerate 2 tests to remove pzext.h.b.
Original message:
Add combineShiftToAVGSUB, which forms AVGSUBFLOORS/AVGSUBFLOORU on a
narrower type when both operands are known to be extended from it, so
the subtract can't overflow. This is similar to combineShiftToAVG.
The node is only formed if it is legal or custom on the narrow type or
the original type after type legalization. As long as type legalization
won't change the element type. This covers WidenVector, SplitVector and
ScalarizeVector. This can be relaxed in the future.
Remove the RISC-V P extension truncate combine for (P)ASUB(U) since this
is now handled by the generic combine.
[libc] Make ldexpf128/scalbnf128/scalblnf128 use emulated Float128 (#220295)
This makes the three exponent scaling functions ldexpf128, scalbnf128
and scalblnf128 work with the emulated Float128 type, so they can be
used on platforms without native __float128.
Fixes #219759 (part of #216576).
[GlobalISel] Auto-commute combine patterns
Emit both operand orders for constrained commutative generic match
patterns, including each use of a PatFrag. Skip redundant permutations
and enforce MaxPermutations before allocating expanded alternatives.
Give each permutation its own operand expansions so operand indices
cannot leak between alternatives.
Keep commuted immediate patterns available with constant-to-RHS
canonicalization, and consolidate AMDGPU carry rules while preserving
zero-addend and RHS-first matching.
Make the integer and AMDGPU multiply/select helpers accept either operand
order.
Add emitter documentation and TableGen, MIR, and codegen regressions.
[MLIR][ROCDL] Note the deprecation of the <4 x i32> buffer ops
While we don't have a way to flag a MLIR op as deprecated yet, go
ahead and add a note to the old `<4 x i32>` intriinsic ops that
they're actively deprecated.
AI disclosure: Claude made this edit, though I checked the wording and
wrote up this message.
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
[AMDGPU][docs] Document the <4 x i32> buffer intrinsic deprecation (#231302)
Flag the deprecation of <4 x i32> buffer intrinsics in the release
notes, flagging the migration path and the s.buffer.load subtleties.
AI disclosure: Claude did draft some of this, but I deleted basically
all of it and the words are mine.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[AMDGPU][NFC] Clean up pre-gfx125x test RUN lines
Drop flags that match defaults: -verify-machineinstrs in .ll tests,
-global-isel=0 in tests without a GlobalISel run, and redundant
-global-isel-abort. Use subarch triples instead of amdgcn plus -mcpu.
Error-only MC runs use -filetype=null.
Change-Id: Ic8e2469780e32dbe204a032fcf9d91a1e8b737d2
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU][NFC] Clean up gfx125x test RUN lines (#238105)
Drop flags that match defaults: `-verify-machineinstrs` in `.ll` tests,
`-global-isel=0` in tests without a GlobalISel run, and redundant
`-global-isel-abort`.
Use subarch triples instead of amdgcn plus `-mcpu`.
Error-only MC runs use `-filetype=null`.
[Clang][SYCL] Reject an NVIDIA offload target for SYCL (#229937)
Reject an NVIDIA offload target for SYCL.
Previously, `clang++ -fsycl --offload-arch=sm_80`, or
`--offload-targets=nvptx64-nvidia-cuda`, hit an assertion in the CUDA
toolchain, which supports only CUDA and OpenMP. Clang does not support
SYCL offloading to NVIDIA GPUs without `-foffload-via-llvm`, so the
driver now reports "invalid or unsupported offload target" instead. With
`-foffload-via-llvm`, SYCL offloading to an NVIDIA GPU is unchanged.
[AMDGPU] Add cluster size tests for full multicast load masks (NFC)
Add tests for a cluster load with a full workgroup mask in functions with
no cluster, a fixed cluster of 8 or 16 workgroups, and a cluster size only
known at run time. The checks show the current lowering, which clamps the
mask in all of them.
[AMDGPU] Treat a bitcast between legal types as free
The generic cost model treats a bitcast as free only when both types
are integer types or both are not. AMDGPU keeps integer and
floating-point values in the same registers, so a bitcast between two
legal types is a no-op. A scalar bitcast from i32 to float cost 1, but
the vector bitcast from <2 x i32> to <2 x float> cost 0. The SLP
vectorizer counted this difference as a saving.
A bitcast that involves a type the target legalizes, such as a vector
of i8, keeps its cost, because the lanes may need repacking.
Assisted-by: Claude Opus
[SystemZ][z/OS] Unconditionally use DynamicNoPIC relocation model (#238087)
On z/OS, generated code is always position-independent, so -fpic and
-fno-pic have no effect. Previously, getEffectiveRelocModel() returned
the requested relocation model if one was provided. When -fpic was
passed, TargetMachine:: isPositionIndependent() returned true, enabling
optimizations such as relative lookup tables that generate 32-bit
relative offsets between globals. These are incompatible with the GOFF
binder's requirement for 8-byte relocations in C_WSA64.
This change forces getEffectiveRelocModel() to always return
Reloc::DynamicNoPIC on z/OS, regardless of what the frontend requests.
Assisted-by: IBM Bob
[AMDGPU][NFC] Add bitcast cost tests for legalized types and pointers
Add bitcasts that involve types the target legalizes, such as vectors
of i8, i24 and <2 x i24>, and bitcasts of pointers. Add a gfx7 RUN
line, where i16 and <2 x i16> are not legal.
Assisted-by: Claude Opus
[lldb][Windows] Lock DebuggerThread::m_process against the debug loop (#236560)
When the inferior exits before its initial stop, the debug loop resets
`DebuggerThread::m_process` but the launching thread copies it. Both
threads touch the same `shared_ptr`, which corrupts the heap, and
lldb-server dies with `0xC0000374`.
This causes `TestMissingDll.py` to fail with `"Sending vRun packet
failed"`.
This patch guards `m_process` with a mutex.
Tested on Windows with the race window widened: 21 of 800 launches
crashed before, 0 of 4800 after. `TestMissingDll.py` passed 1600 of 1600
runs.
rdar://191149207
[BoundsSafety][NFC] Add late-parsed type attribute lists to declarators (#224559)
This is groundwork for late-parsing type attributes in every type
position where an ordinary type attribute can appear, following the
direction set in https://github.com/llvm/llvm-project/pull/223267, which
allows a CountAttributedType's count to be filled in later.
Ordinary type attributes are kept on the DeclSpec, on each
DeclaratorChunk and on the
Declarator. Give late-parsed type attributes the same three homes, with
nothing producing or consuming them yet.
No functional change: no caller passes a list yet, so the lists stay
empty. The next commit populates them.
Assisted-by: Opus 5.5
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[lldb] Add eBroadcastBitReadyForInput to SBCommandInterpreter
Add eBroadcastBitReadyForInput to CommandInterpreter and
SBCommandInterpreter, and emit it from IOHandlerEditline::GetLine and
embedded_interpreter.py when waiting for input on the debugger input
stream. Also flush stderr before prompting in embedded_interpreter.py's
readfunc_stdio.
Add SBCommandInterpreterTest unit tests covering pipe input, sourced
files, multiline sub-IOHandlers, PTY editline input, and the interactive
embedded Python interpreter.
[libc] Bound the decimal point check in simple_decimal_conversion (#238179)
HighPrecisionDecimal clamps the decimal point to 1 << 30, but
exp10_to_exp2
is only valid for inputs below 646456636. For larger decimal points the
result wrapped to a negative value, so the "too large" and "too small"
checks did not trigger and the shift loops ran tens of millions of
iterations until exp_2 overflowed (signed integer overflow).
Treat decimal points at or beyond the valid range of exp10_to_exp2 as
out of
range, and use add_overflow/sub_overflow for exp_2 in the shift loops so
that they stay well defined.
Assisted-by: Claude (Anthropic)
RuntimeLibcalls: Only apply vector math attributes to floating point vectors
i128 is now <2 x i64> on Win64, which made the vector type checks treat
integer helpers like __atomic_load_16 as vector math functions and mark
them nosync and nofree. Check for a floating point vector argument.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply at anthropic.com>
SelectionDAG: Use the memory type for atomic libcall actions
The atomic libcall selection is driven by the memory type, not the
legalized value type. Convert targets to use the LibCall action
instead of Expand.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>