PowerPC branch fixup diagnostic (#235535)
## Summary
Name the branch in the "out of range" and "not multiple of four"
diagnostics.
Previously when adjustFixupValue()/checkBrFixup() rejected a branch
whose displacement
did not fit the instruction field or the target was not a multiple of
four, the diagnostic message did not say which branch failed and where
it was going.
Fixups from generated code, such as output from `llc` or BOLT, have no
source location either.
For example, llvm/test/CodeGen/PowerPC/call-overflow-error.ll (AIX)
printed:
<unknown>:0: error: branch target out of range (-33554736 not between
-33554432 and 33554428)
[25 lines not shown]
[libc++][Android] Guard SELinux filesystem subtests and forward stdin in adb_run.py
Follow-up to #243692 addressing the remaining Android filesystem and `std::{cin,wcin}` `LIBCXX-ANDROID-FIXME` tests:
- Add `has-no-{fifos,hardlinks,sockets}` lit features to guard filesystem subtests, including on Android where SELinux blocks them for the `shell` user in `/data/local/tmp` on Android N (API 24) and up, allowing the rest of those tests to run.
- Forward non-TTY stdin via a temporary file in `adb_run.py` when `shell_v2` is unavailable so `std::{cin,wcin}` tests don't hang waiting for EOF on API 23.
Assisted-by: Gemini
[SPIRV] Add support for @llvm.lrint.* and @llvm.llrint.* intrinsics (#217618)
The SPIR-V legalizer had no rule for `G_INTRINSIC_LRINT` /
`G_INTRINSIC_LLRINT`, so `llc` aborted with "unable to legalize
instruction" on `llvm.lrint` and `llvm.llrint`. This uses the generic
lowering to `G_FRINT` + `G_FPTOSI`, which selects to OpenCL.std `rint`
(GLSL.std.450 `RoundEven` on Vulkan) followed by `OpConvertFToS`, the
same shape as the existing `lround` handling.
As with `lround` and `fptosi`, an out-of-range result goes through
`OpConvertFToS`, which is undefined behavior in SPIR-V, whereas LangRef
specifies `freeze poison` for lrint/llrint.
This PR was generated using AI
[SPIR-V] Drop nsz and reassoc from fmin/fmax selected for minnum/maxnum (#231767)
The selector copied every fast-math flag of `G_FMINNUM`/`G_FMAXNUM` onto
the fmin/fmax (NMin/NMax) `OpExtInst`, so `nsz` became `FPFastMathMode
NSZ` and `reassoc` became `Fast` (or a float_controls2 mask including
`NSZ`). SPIR-V NSZ treats the sign of a zero result as insignificant,
while LangRef requires nsz minnum/maxnum to keep the sign when both
operands are zeros of the same sign. Clear `nsz` and `reassoc` before
selecting these instructions; the `llvm.minimum`/`maximum` expansion
still reads `nsz` earlier in IR.
Fixes https://github.com/llvm/llvm-project/issues/231758
This PR was generated using AI
[CodeGen] Model latency of inline asm outputs in ScheduleDAGInstrs (#244934)
Credits: @MaskRay
`addPhysRegDataDeps` treats defs beyond an instruction's fixed operands
as fake, with zero latency. `INLINEASM` has no fixed operands, so every
physical-register asm output gets zero latency, unlike the
virtual-register path.
Treat a def inside an inline asm operand group (outputs, including
fixed-register outputs, and clobbers) as a real def. Trailing
bookkeeping operands keep zero latency.
As a followup of #229764
Discussion originally provided by @MaskRay :
https://github.com/llvm/llvm-project/pull/229764#issuecomment-6940301539
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[nsan] Reset shadow of byval arguments at function entry (#245262)
Fixes #243120
**Problem:**
The copy of a `byval` argument is put into stack memory for which the
caller never writes shadow values, and nsan's argument hand-off only
carries floating-point-typed arguments. The callee could then in some
cases read stale shadow left by earlier frames and report false
positives after other code has dirtied the same stack region.
See #243120 for more information.
**Solution**
Upon function entry, reset the shadow of each `byval` parameter to
unknown value. This way any future loads from it fall back to the native
value instead.
This is the conservative option: shadow precision of by-value aggregates
is lost on entry, so accumulated error inside such a struct is not
[17 lines not shown]
[PowerPC] Fix little-endian conversion of an unsigned word in a VSR to f128 (#242394)
On little-endian Power9, (f128 (uint_to_fp (i32 (PPCmfvsr f64:$src))))
was selected to xxextractuw with byte offset 8, which takes word element
2 of the VSR. The value is in word element 1, as used by mfvsrwz and by
the big-endian version of this pattern, because xscvdpuxws and similar
instructions write their result there in either endianness. The byte
numbering of xxextractuw does not depend on the endianness either.
For example, with clang -O2 -mcpu=power9 -mfloat128 on little-endian:
__float128 f(double d) { return (unsigned)d; }
was compiled to:
xscvdpuxws 0, 1
xxextractuw 34, 0, 8
xscvudqp 2, 2
[4 lines not shown]
[CIR] Fix VecExtract index type in Vec truncation cast (#246065)
Fix the index type in VecExtractOp to be size_t, not hard-coded s64i in
vector truncation cast
[ARM][clang] Add _AddressOfReturnAddress for 32-bit Arm (#240575)
_AddressOfReturnAddress was not a builtin on 32-bit Arm, so a call to it
became a call to a function that doesn't exist, and the ARM backend
could not lower llvm.addressofreturnaddress. Add the builtin, as on
AArch64, and lower the intrinsic to the LR slot of the frame record, the
frame pointer + 4. So that this slot holds the return address, a function
that takes it spills LR even when it is a leaf, and on ELF Thumb-2 keeps
r7 and LR together.
Assisted-by: Claude Opus 5.5 (Anthropic)
[ABI][AARCH64][NFC] Make SveCount a unique type (#245767)
The LLVM ABI library previously modeled SveCount (the AArch64
predicate-as-counter type) as a vector with a special kind to
distinguish it. Upon further reflection, this seems to have been a bad
choice as this type has almost no overlap with other vector types apart
from the fact that it occupies a predicate register.
This change separates SveCount as a separate type in the ABI library.
The classification and the LLVM IR type to which it is mapped remain
unchanged.
Assisted-by: Cursor / various models
[Clang][OpenMP] Fix static,1 inner loop bound (#239868)
The inner loop of a combined distribute parallel for compared its
iteration variable directly with .previous.ub., whose parameter type is
uintptr_t. This could widen a signed i32 iteration variable to i64 and
make the comparison unsigned.
Reuse the existing conversion of .previous.ub. to the loop upper-bound
type when building the inner-loop condition. Update the affected OpenMP
codegen checks and add a focused test for signed and unsigned i32 loops.
Assisted by gpt-6.
[mlir] Add @FedericoBruzzone as a co-maintainer of `Vector` (#245162)
Since starting his upstream involvement earlier this year, Federico has
become a very active and recognisable contributor to `Vector` (PRs,
reviews, RFCs).
From the beginning, Federico's `Vector` interests extended beyond his
own PRs. Indeed, he has reviewed 4 times as many PRs as he has submitted
himself! In addition, he has been putting a lot of effort into tracking
`Vector` activity on GitHub (there's been a lot). See e.g.:
* https://github.com/llvm/llvm-project/issues/235708
This PR simply formalises what Fede has already been doing informally.
[mlir][SPIR-V] Deserialize constant composites with OpUndef constituents (#245516)
spirv.Constant cannot hold undef values, so build such vectors, arrays
and structs with spirv.CompositeConstruct at each use
[mlir][SPIR-V] Add SPIRVToLLVM conversion for PtrEqual and PtrNotEqual (#242826)
Use adaptor operands in IComparePattern because pointer operand types
change during conversion
Depends on https://github.com/llvm/llvm-project/pull/242824