[runtimes] Make runtimes-test-depends depend on flang (#241544)
This patch adds runtimes-test-depends to add_flang_mod_deps so that
"ninja test-depends" in a fresh build directory waits for bin/flang
before building flang-rt-mod via fakeflang.
Note that #203481 and #235643 already added the same dependency for
check-flang-rt, check-openmp, and check-offload.
Assisted-by: Antigravity
[mlir][VectorToSCF] Clamp the create_mask bound in the scalable transposed write (#243714)
`ScalableTransposeTransferWriteConversion` lowers a masked write of a
transposed `vector<[N]xMxty>` to a loop over the scalable dim, and used
the first `vector.create_mask` operand as the loop bound. `create_mask`
clamps its operands to the vector size, so `vector.create_mask %c100,
%c4 : vector<[4]x4xi1>` is all-true, but the loop wrote 100 rows instead
of `4 * vscale`.
The loop bound is now `min(mask size, N * vscale)`.
Tested by `@scalable_transpose_store_dynamic_mask`. Also run on SVE
hardware (Graviton3, vscale = 2) with `create_mask %c100, %c4` into a
16-row memref: main writes 100 rows, this patch writes 8.
Part of #227821.
Assisted-by: Claude
[mlir][SPIR-V] Add SPIRVToLLVM conversion for CompositeConstruct (#244369)
Lower structs and arrays to llvm.insertvalue chains and vectors to
llvm.insertelement chains, splitting vector constituents into elements
[mlir][SPIR-V] Fix deserializer crash on spec composite constituents (#244375)
Accept nested OpSpecConstantComposite constituents and diagnose the ones
that have no symbol to reference
[SelectionDAG] Use the compare operand's boolean contents when inverting a SETCC (#244992)
When LegalizeDAG expands a SETCC by inverting its condition code, it
wraps the new SETCC in getLogicalNOT() using the result type. That
picks the true value from the integer boolean contents, but the SETCC
result follows the boolean contents of the compared operand type.
On MIPS R6 FP compares produce 0/-1 while integer booleans are 0/1.
Since #173541 SETUNE, SETONE, SETO and SETNE are expanded this way, so
the inverted mask was XORed with 1, giving 1/-2 instead of -1/0, and
later combines produced wrong values.
Build the NOT with getBoolConstant() using the operand type, as the
SELECT_CC fallback below already does. Also let extractBooleanFlip()
recognize such a NOT of a SETCC, so select (not setcc) keeps folding
to a select with swapped operands.
MIPS R6 is the only target where the integer and FP boolean contents
differ, so other targets are not affected.
[3 lines not shown]
[ubsan] Initialize flags before installing deadly signal handlers (#244984)
When `SANITIZER_CAN_USE_PREINIT_ARRAY` is 0 or UBSan is linked as a
shared library, a `.preinit_array` function or DSO constructor calling
`sigaction()` can run `InitializeDeadlySignals()` before flags are
parsed, permanently skipping signal handlers requested via options.
Assisted-by: Gemini
[GVN] Merge metadata from values to load
A select from load con contain different metadata premise. Such
metadata might be incompatible and therefore be poisoned. Merge the
metadata and propogate to the previous load to eliminate this.
Asissted-by: Cluade # Test
[X86][AVX10.2] Use INTR_TYPE_1OP_MASK_SAE for 512-bit VCVTTP.*QS intrinsics (#244127)
They are SAE instructions like VCVTTP.*Q.
Assisted-by: Claude Opus 5.5
Attributor: Don't report a change when no functions are internalized
internalizeFunctions returned true for an empty set, so this reported
a change for every module and invalidated all function analyses even
when it did nothing.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
OpenMPOpt: Invalidate function analyses individually
Avoid discarding analyses that never need to be invalidated, such as
TargetLibraryInfo.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Attributor: Decide which instructions access memory in the opcode switch (#241115)
initializeInformationCache already switches over the opcode of every
instruction, and then called mayReadOrWriteMemory out of line for each
one. Decide in the switch instead, where only calls need to check their
memory effects.
Instruction counts (callgrind) with other pending attributor-light
changes applied: attributor-light sqlite3 -0.79%, kimwitu++ k -0.32%,
SPASS cnf -0.31%, consumer-typeset z08 -8.59%; the full attributor
-0.02% to -0.08%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
ExpandVariadics: Report a change when rewriting a function without calls
This only reported a change if it rewrote a call, but it always
rewrites the function itself. In lowering mode a variadic function
without callers was changed without being reported.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86][MC] Fold parenthesized register scale expressions (#237899)
Fix incorrect scales in Intel memory operands such as `rbx*(1+1)` and
`rbx*(4/2)`, which currently use scales 1 and 8 instead of 2.
Evaluate parenthesized constants with the existing intel expression
parser, preserving named operators. Validate the full-width scale and
diagnose division/modulo by zero, signed division overflow, and invalid
shift counts.
Validation:
- 713 selected X86 MC and llvm-ml tests passed with assertions enabled.
- 537 supplementary local checks passed across 16/32/64-bit modes.
Partially addresses #150427. Expressions such as `(rax+1)*2` remain
outside this change.
[X86] Fix spill folding of zero-extending mask moves (#240833)
`KMOVBkk`, `KMOVDkk` and, with BWI, `KMOVWkk` zero the mask bits above
their width, but `X86InstrInfo::isCopyInstrImpl` reports them as copies.
Since 4d42e8b5 (D150388), spill folding then replaces such a move with a
spill of its source, so the zero extension is lost (#240463).
Spill folding is correct for real copies, so this patch stops treating
these moves as copies: `KMOVBkk`, `KMOVDkk` and their `_EVEX` forms are
no longer marked `isMoveReg`, and `isCopyInstrImpl` excludes `KMOVWkk`
when BWI is available. Without BWI, `KMOVWkk` moves the whole mask
register and stays a copy.
Fixes #240463
Assisted-by: Claude Opus 5.5
[Clang] Fix qualifiers of ext vector components accessed via `->`
For `p->x` where `p` points to an `ext_vector_type` vector, Sema takes the
qualifiers from the type of `p`, which is the pointer itself, instead of the
vector it points to. As a result, `p->x = 1` is accepted even if `p` points to a
`const` vector, while `(*p).x = 1` is rejected. An address space on the vector
is lost in the same way.
This PR takes the qualifiers from the vector for both `.` and `->`. A swizzle
that repeats a component, e.g. `v.xx`, is a computed value, so it doesn't get
any qualifiers.
This PR was assisted by AI but I reviewed all the changes.
[flang][OpenMP] Evaluate composite DISTRIBUTE clauses outside PARALLEL
In composite DISTRIBUTE PARALLEL DO [SIMD], omp.distribute is nested
inside omp.parallel, and the DISTRIBUTE clauses were evaluated after
omp.parallel was created. A DECLARE VARIANT call in the DIST_SCHEDULE
chunk-size expression therefore matched construct={parallel}, although
DISTRIBUTE encloses PARALLEL in the source, and every thread evaluated
the expression.
Evaluate the DISTRIBUTE clauses before creating omp.parallel, as for the
explicit nesting, and destroy their temporaries once, after omp.parallel.
Fixes #244760
Assisted-by: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot at users.noreply.github.com>