[Clang][CUDA] Preserve addresses of scalar grid-constant parameters (#231567)
Partially fixes #230158.
Clang currently passes scalar `__grid_constant__` parameters by value,
so taking their addresses creates local copies instead of referring to
the original kernel parameters.
This patch passes scalar and vector grid-constant parameters as `byval`
pointers, avoids unnecessary local copies, and updates `CGFunctionInfo`
to account for the ABI differences.
Host-side kernel argument handling remains unchanged.
Added CodeGen tests for scalar, vector, and aggregate parameters.
`__isGridConstant()` is not addressed by this patch.
[Clang] Add regression test for enum class with dependent decltype bottom type (#247197)
### What this patch does
Adds a regression test for the pattern reported in #114124: an `enum
class`
whose underlying type is deduced from a member function call
(`enum class e : decltype(f())`), where `f` is a member of the class
that is
currently being defined, so its return type has not been deduced yet.
The test checks that the code is rejected with
error: function 'f' with deduced return type cannot be used before it is
defined
note: 'f' declared here
instead of crashing in `ASTContext::getTypeInfoImpl`, which is what
clang 18
[22 lines not shown]
[mlir] Split analysis management from the pass library
Let analysis clients own a cache or use one supplied by a pass. Send cache construction events through AnalysisInstrumentation and forward the pass instrumentor through the executor for pipeline and pass callbacks.
[mlir] Pass analyses to speculation hooks and LICM
Let ConditionallySpeculatable models implement either the simple hook or one that accepts a nullable AnalysisManager. Forward the manager through recursive purity queries and loop-invariant code motion. Exercise the simple external model through both entry points.
[DA] Remove the unused legacy DependenceAnalysisWrapperPass (NFC) (#247164)
Nothing requests the legacy pass any more; all users of dependence
information use the new pass manager's DependenceAnalysis.
PR: https://github.com/llvm/llvm-project/pull/247164
[X86][FastISel] Don't look through bitcasts when forming an address (#242973)
Fixes #242844
`X86SelectAddress` and `X86SelectCallAddress` looked through any
bitcast, so a bitcast that changes the register class (`bitcast double
%x to i64` feeding an `inttoptr`) put an XMM register in the address.
With opaque pointers the only bitcast still worth folding here is a
no-op one, which `selectBitCast` already handles, so remove the two
cases.
[SCEV] Move getFlagsToPropagate to SCEVUse (NFC). (#247117)
This removes one level of indirection and hasNo(Un)SignedWrap helpers,
replacing them with the existing any(Op.getNoWrapFlags()) idiom used
throughout SCEV.
In the future patches, we will likely need to check more properties of
the use to determine what flags are safe to propagate.
PR: https://github.com/llvm/llvm-project/pull/247117
[mlir][scf] Reduce the values of all unrolled iterations of scf.parallel (#240948)
Example:
```mlir
%r = scf.parallel (%i) = (%c0) to (%c8) step (%c1) init (%init) -> f32 {
%v = memref.load %a[%i] : memref<8xf32>
scf.reduce(%v : f32) {
^bb0(%lhs: f32, %rhs: f32):
%s = arith.addf %lhs, %rhs : f32
scf.reduce.return %s : f32
}
}
```
In this code, parallelLoopUnrollByFactors() with a factor of 2 clones
the load, but scf.reduce kept only the value of the last copy, so the
loop summed every other element.
Fix: combine the values of all the copies with the reduction function
[2 lines not shown]
[Clang] Ensure NTTP decls are traversed when building parameter mapping (#246548)
They were not traversed when their types were dependent, hence we were
not checking them correctly.
Mirrors fixes in 92d8313
Fixes https://github.com/llvm/llvm-project/issues/246501
[SystemZ] [HLASM] Set .&ppa2 alias (#246121)
'.' and '&' are not allowed in HLASM symbol names, but `.&ppa2` is
currently generated for the PPA2 section. Use ALIAS to fix the PPA2
section naming.
[Hexagon] Update HLX instruction timings (#246386)
- Move the existing HLX arithmetic timing classes (absdiff, mpa, mpy,
and shra) from TC1 to TC2.
- Add dedicated HLX timing classes for abs, add, and mux operations, and
assign them to the related abs, assignment, conversion, logical,
comparison, and min/max instructions. These previously shared scalar
timing classes.
- Update the HLX itineraries for every architecture version with the new
operand cycles and execution slots, so that the disassembler can decode
HLX packets when no V85 CPU is specified.
Fixes #246424
Signed-off-by: Rishabh Bali <rbali at qti.qualcomm.com>
[libsycl] Extend supported device info queries (#244699)
Enables all device information queries that currently have a liboffload
counterpart. Caching will be done as a follow up change.
Assisted-by: Claude Code
[LoopInterchange] Don't interchange loops with convergent calls (#241912)
Interchange moves the outer loop header and latch into the new inner
loop, so a convergent call there ends up inside both loops. That can
change the set of threads that execute it together:
```c
for (i = 0; i < 128; ++i) {
m = subgroup_reduce_add(x); // runs in all threads
for (j = 0; j < n; ++j) // n differs between threads
A[j][i] = m;
}
```
After interchange the reduction is inside the loop over j. For j >= 1
only the threads with n > j run it, so it sums over fewer threads and
A[j][i] gets a different value.
Reject the interchange if either of the two loops contains a convergent
call. This is conservative: it also rejects convergent calls in the
[2 lines not shown]
[GVN] Delete pointer cast traversal in collecting invariant_group. NFC (#246940)
Typed ptr is retired in previous LLVM version. Adding this to queue
performs no-op in here. Drop this directly.
[OpenCL][Clang] Add initial support for cooperative matrix extension (#221328)
Add initial frontend support for OpenCL cooperative matrix types and builtins.
Represent cooperative matrix types in LLVM IR using TargetExtType rather
than ordinary matrix or aggregate types. Add Sema handling to recognize
cooperative matrix declarations and validate their type parameters,
uses, and builtin calls.
Lower cooperative matrix builtins through the OpenCL CodeGen path,
including
emitting the corresponding target-specific operations and converting
their arguments to the expected types.
Document the `coop_mat` attribute and note that the cooperative matrix
extension specification is experimental and still in draft, so the
implementation and its interfaces may change.
The corresponding specification document is under review in OpenCL-Docs
[10 lines not shown]
[mlir][SPIR-V] Support untyped pointers in GlobalVariable (#246156)
Add an optional data_type for the object type and serialize module scope
variables as OpUntypedVariableKHR
[libsycl] Fix unit-test mock after olCreateContext const change (#247208)
PR https://github.com/llvm/llvm-project/pull/244215 made the `Devices`
parameter of `olCreateContext` a
`const ol_device_handle_t *`. The libsycl unit-test mock still defined
the function with a non-const pointer, which declares a separate C++
overload instead of the `extern "C"` entry point, so the unit tests
failed to link with an undefined `olCreateContext`.
Update the mock definition, the gmock method and the test lambdas to
the new signature, and stop casting away const in the default action.
Assisted-by: Claude
[mlir][arith] Narrow arith.select via int ranges
Add a `NarrowSelect` pattern to `populateIntRangeNarrowingPatterns` so
`arith-int-range-narrowing` narrows `arith.select` operations over
signless integer or index scalars, vectors, and tensors when both arms
and the result fit in a narrower target bitwidth under a common signed
or unsigned extension.
`NarrowElementwise` requires all operands to share the result type and
therefore skips `arith.select` due to its `i1` condition operand,
leaving redundant widen/truncate pairs around selects inside narrowed
arithmetic chains.
Assisted-by: gemini-4-carbon
[mlir][IntRange] Unwrap nested shaped value types
Update `ConstantIntRanges::getStorageBitwidth` to recursively unwrap
nested `ShapedType` containers that carry the `ValueSemantics` trait
(such as `tensor<...xvector<...xi32>>`), returning 0 for shaped types
without value semantics (such as `memref`).
This ensures a tensor type and its element type always agree on storage
bitwidth, enabling integer range inference to propagate through
`tensor.extract`, `tensor.from_elements`, `tensor.insert`, and
`tensor.splat` on tensors of integer vectors and removing the
`!isIntOrIndex()` workarounds introduced in 2c7efd6f6e1b.
Tighten `IntRangeOptimizations` to reject types with zero storage
bitwidth during constant materialization and to skip elementwise
narrowing when the immediate element type is not an integer or index.
Assisted-by: gemini-4-carbon