[SystemZ][z/OS]Add -fzos-le-char-mode=ascii (#248965)
Many build configs add this option when building on z/OS. This includes
cmake adding the option when it is used. This will add the option with
the `ascii` suboption. We will add the `ebcdic` suboption in the near
future.
This options will produce an unsupported error on non z/OS platforms and
the `ebcdic` will produce an unsupported value error on z/OS until we
enable that support.
[libc] Fix callonce ordering and futex wait loop (#249209)
callonce_fastpath used a relaxed atomic load, allowing callers on weakly
ordered architectures to observe FINISH before writes made by the
callback became visible. callonce_slowpath also waited on the futex only
once, so a spurious FUTEX_WAKE let waiting callers return before
initialisation finished.
Pair acquire loads and CAS operations with a release exchange to FINISH,
and loop in callonce_slowpath until FINISH is observed.
Follows the futex wait-loop discipline in Ulrich Drepper, "Futexes Are
Tricky" (2011):
https://akkadia.org/drepper/futex.pdf
Assisted-by: Automated tooling, human reviewed.
[DebugInfo][CloneFunction] Clone elements of local types
After https://github.com/llvm/llvm-project/pull/165032, when a
DISubprogram is cloned in CloneFunction(), its local types are cloned
too. However, nodes in scope of a cloned local type, such as type
elements and nested types, were not cloned. It was leaving the cloned
type in an inconsistent state: its `elements:` were still pointing to
the original type as a scope.
To fix that, identityMDPredicate now traverses scope chains of types and
declaration subprograms, and marks them for cloning if they are in scope of
a type that is to be cloned.
To avoid traversing parts of the same scope chains multiple times, when visiting
different nodes in scope of the same type, the predicate caches decisions for
scoped types.
A Verifier check for incorrectly scoped type elements will be added
in a follow-up patch
[SLP]Respect UseMask for non-constants in isUndefVector
isUndefVector ignored masked-out lanes for non-constant vectors and
dropped UseMask when recursing on insertelement chains. A fully
overwritten non-constant <1 x T> base was then treated as live and
shuffled through ShuffleInstructionBuilder, asserting in getVF.
Fixes #249136
Pull-request: https://github.com/llvm/llvm-project/pull/249238
[libc++] Make __promote work with _BitInt, test for _BitInt in math functions (#248826)
Fixes #248462
The problem was that `__promote` hardcoded a list of accepted integer
types, so it wouldn't accept `_BitInt`, which can be fixed by having a
generic case for all integral types.
To verify that the solution works, a temporary
`types::bit_ints_8_16_32_64` list is added, which should be folded into
`types::integral_types` eventually.
[AArch64] Decompose store(insert(insert(..)) to separate stores. (#246716)
Given a store(buildvector) we will lower the buildvector to vector lane
inserts, which means expensive cross register bank copies for each lane
to store as a vector. Split the operation up instead, generating
individual store operations for the values on each lane. This generates
more stores but less expensive vector moves.
This is a recommit of #238314 with extra checks to hopefully prevent
combine loops between mergeConsecutiveStores and the new combine.
[llvm-mca][x86] Add more AVX512 FMA instruction permutations (#249221)
I still need to get the AVX512VL variants done, but this at least gets
the AVX512F core instructions tested
[SystemZ] Extend or truncate @cc flag output to the constraint type (#245401)
LowerAsmOutputForConstraint always returned the i32 IPM/SRL result for
`=@cc`, regardless of the output type. For a 64-bit output like `long`,
SelectionDAGBuilder then tried to truncate the i32 to i64. That hits the
"Invalid truncate node" assertion, and in release builds it produces a
bad node, which gives wrong code on z13 and later.
This zero-extends or truncates the CC value to `OpInfo.ConstraintVT`,
the same way X86 and AArch64 handle their flag outputs. Codegen for
i8/i16/i32 outputs doesn't change; i64 now gets `ipm` + `risbg`. I added
i64 cases to inline-asm-flag-output-01.ll: a plain return, a branch on
the CC value, and a store.
Fixes #245177
[X86] Prevent poison propagation when inserting i8/i16 into zero vector (#248935)
In `LowerINSERT_VECTOR_ELT`, zero-extending an `i8`/`i16` element to
`i32` before `SCALAR_TO_VECTOR` + `VZEXT_MOVL` can propagate
`undef`/`poison` into adjacent zero lanes (same as #248666 for
`LowerBUILD_VECTOR`). Also fixes the SSE4.2 cases from #246207 (covered
by #249006).
Fixes #248928
Assisted-by: Gemini 4 Neon
[CODEOWNERS] Remove "masked" rules (#248903)
As per GitHub docs (see the link in CODEOWNERS file):
* "the last matching pattern takes the most precedence."
Remove rules that are currently masked (i.e. not in use). The Arith
files receive @kuhar @krzysz00, and the XeGPU TransformOps directories
receive @ftynse @nicolasvasilache @rolfmorel. The EmulateNarrowType.cpp
file receives @dcaballe .
[VPlan] Don't count extract-lane users as introducing broadcasts. (#249084)
Like the other extracts already excluded in narrowToSingleScalarRecipes,
ExtractLane of a single-scalar folds to the scalar. Exclude it too, so
recipes only used by extract-lane (e.g. selects feeding exit values) can
be narrowed.
[VPlan] Fold ExtractPenultimateElement of single scalars after unrolling. (#249214)
After unrolling, ExtractPenultimateElement extracts from a single part,
so for single-scalar operands it can be replaced by its operand, as
already done for ExtractLastLane. Only fold the operand kinds also folded
forExtractLastLane.
So far VPInstruction::generate handled single-scalar operands implicitly
via VPTransformState's lane map. Folding them in VPlan allows generate
to assume vector operands. For live-ins, this removes the broadcast and
the extract of the penultimate element.
[AArch64][GlobalISel] Add generic G_UMULL and G_SMULL nodes. (#236058)
This ports the AArch64 specific G_SMULL and G_UMULL instructions to be
generic instructions usable by any target. It has two legalization
types, it is generally expected at the moment to have an output twice
the size of the input, but legalization rules in GISel do not limit us
to this factor. Having target independent nodes allows us to legalize
more cleanly.
[LLVM] Migrate call-sites w/o CtxI to new computeSignBits API (#249011)
Migrate to the new computeSignBits SimplifyQuery API in all cases except
when a context-instruction is supplied, defering the issue of safeCtxI
for a follow-up. The SCEV test change can be explained by UseInstrInfo
due to the construction of SQ: there are surely other functional changes
that could be covered with new tests, but we have chosen not to include
new tests.
Assisted-by: llm
[AArch64] Fix immediate cost in numberOfInstrToLoadImm (#249199)
The immediate was being treated as 32 bits, even if the original imm was
64, producing the wrong costs for converting conditions to cheaper
immediates. Fixes #248733
[SPARC] Address objects relative to %sp when far away from %fp (#248810)
Frame objects are addressed relative to %fp. When an access is out of
immediate range from %fp, its address is built with multiple
instructions even if the object is close to %sp. Use %sp instead when
the offset fits there and the call frame is reserved, so that %sp does
not move.
Assisted-by: Claude
[SPARC] Add the LEON5 STBAR options to the assembler (#240762)
LEON5 uses unused bits of the STBAR instruction to implement
functionality similar to the MEMBAR instruction in SPARC V9. It also
provides a write-combining hint for the following store.
Assisted-by: Claude