Repository navigation
Conversation
There are cases in which `getEntryIDForSymbol` is called, where the
given Symbol is in a constant island, and so BOLT can not find its
function. This causes BOLT to reach `llvm_unreachable("symbol not
found")` and crash. This patch adds a check that avoids this crash.
…rator (#184725) `shouldTrackImplicitObjectArg` tracks whether a method call's return value depends on the implicit object's lifetime. It already handles operator* on Owner types (return reference), but misses operator-> (return pointer). This fix adds `OO_Arrow` handling for Owner types. Only affects CFG (-Wlifetime-safety) analysis paths. Fixes #184361
…ort (#168171) Attaching `__declspec(dllexport/dllimport)` to explicit instantiation declaration made its whole member instantiated even if they were `__attribute__((__exclude_from_explicit_instantation__))`. Such members should not be instantiated nor be exported to avoid symbol leakage or duplication. Fixes #40363 Fixes #66909
…pend on outer IV (#184770) When affine-super-vectorize creates the vectorized version of an inner loop whose bounds reference the outer loop's induction variable, it was passing the original scalar bound operands directly to the new vector AffineForOp. These operands reference block arguments of the scalar outer loop, which are destroyed when the scalar loop nest is erased, triggering a use_empty() assertion. Fix this by replacing the bound operands with their scalar value replacements (via getScalarValueReplacementsFor) before creating the new vector loop, ensuring the vector inner loop uses the vector outer loop's induction variable. Fixes #121321
…cks (#184094) `BufferAllocationHoisting::hoist()` iterates over all allocations in a function and tries to move them to their common dominator block. When an allocation is in an unreachable basic block (a block that cannot be reached from the function entry), the LLVM dominator tree has no node for that block. Two subsequent calls would then crash: 1. `findCommonDominator` calls `findNearestCommonDominator` which calls the LLVM DomTree equivalent and hits the assertion `NodeA && "A must be in the tree"`. 2. `findPlacementBlock` calls `dominators.getNode(currentBlock)` on the unreachable block, which returns null, causing a null dereference on `->getIDom()`. Fix by skipping allocations whose parent block is not reachable from the entry block of the function. Such allocations are in dead code and there is no need to hoist them. Fixes #118445 Assisted-by: Claude Code
…r (#184158) An affine.for loop with step 0 caused a crash in affine-loop-unroll due to a division-by-zero assertion in getTripCountMapAndOperands: llvm::divideCeilSigned(loopSpan, step) -- step == 0 The parser already rejected negative steps but allowed zero through. Fix this by: - Updating the parser to reject any step <= 0 (not only negative). - Adding a verifier check in AffineForOp::verifyRegions() so that loops constructed programmatically with an invalid step are caught before any analysis pass runs. - Adding a defensive early-return guard in getTripCountMapAndOperands for step <= 0, consistent with getTrivialConstantTripCount which already performs this guard. Fixes #107812 Assisted-by: Claude Code
…ops (#184620) When loopUnrollJamByFactor is called on a loop with a zero trip count (e.g., lb == ub), the function correctly detects that the unroll factor exceeds the trip count and adjusts it to match. However, capping the factor at 0 leads to unsigned underflow when computing the SmallVector size for `operandMaps(unrollJamFactor - 1)`, resulting in an attempt to allocate ~2^64 elements and an immediate crash. Add an early return when the trip count is zero, matching the pattern already used by loopUnrollFull. A loop that executes zero times needs no unrolling. Fixes #103703
When I ran `lldb -o "b main" -o r`, the process crashed at `if (!read_result || m_read_pending)`, because `read_result` was uninitialized. As a sidenote: MSVC inserts calls to `_RTC_UninitUse` which causes a pretty error message when debugging with VS: > Exception has occurred: The variable 'read_result' is being used without being initialized. > Run-Time Check Failure [#]3 - The variable 'read_result' is being used without being initialized. With LLDB, you get ``` (lldb) r Process 12344 stopped * thread #9, stop reason = Exception 0x80000003 encountered at address 0x7ff96516c96a frame #0: 0x00007ff96516c96b liblldb.dll`failwithmessage(retaddr=0x00007ff95742cb02, crttype=1, errnum=3, msg="The variable 'read_result' is being used without being initialized.") at error.cpp:210 ``` We could improve on the stop reason that's displayed.
…… (#115449) …_bits success That could give us a simple way to detect `__init_riscv_feature_bits` got fail. See also riscv-non-isa/riscv-c-api-doc#95
Cast to vXi64 and use EXPAND/COMPRESS to left/right shift the i64 elements into place, then use FSHL/FSHR to perform the final bitshift Fixes: #178215
…rface` (#184116) `LoopLikeOpInterface`'s verifier hardcodes type equality checks for init/iter_arg/yield/result edges. This prevents downstream ops with compatible-but-unequal types from using the pass verifier, since there is no override mechanism. `RegionBranchOpInterface` already verifies types along all control-flow edges and provides an overridable `areTypesCompatible` hook. In practice, most loop ops implement both interfaces, making the `LoopLikeOpInterface` type checks redundant (the existing code even had a comment acknowledging this). This PR removes the redundant type checks from `LoopLikeOpInterface` when the op also implements `RegionBranchOpInterface`, letting that interface handle type compatibility (including any custom `areTypesCompatible` overrides). For ops that only implement `LoopLikeOpInterface` (e.g. `affine.parallel`, `tosa.while_loop`), the strict type equality checks are retained as a fallback. the verifier's loop-result check to use structured bindings with `llvm::enumerate` and remove dead variables.
…4992) When merging ElementSets and ContainerElementMaps, clients can now assert that no elements in the merged sets / maps overlap. Use this to (1) replace a loop in the WaitingOnGraph::Coalescer that was already checking this condition, and (2) add this check to an existing merge that should have this property.
Move G_PHI handling to AMDGPURegBankLegalizeRules.cpp. Support all legal types.
Moved over from AArch64 backend with adjusted registers.
Fix failures after #184819.
…(#184835) This showed up on a benchmark, so getting it out of the way. bzero just does a memset-0, so this lowers to the cir.libc.memset intrinsic. Tests added were from the classic codegen with improved check lines.
…ecuted (#184978) The REQUIRES statement in the builtin_vectorelements.c test case is an all-or-nothing declaration, hence all of the required conditions would need to be fulfilled to make this test being executed. Namely, all of those required targets whould have to be registered, which is a rare situstion, therefore this test case is rarely ever executed. This patch changes those REQUIRES statements into %if conditions. These conditions are needed for those particular targets as their test sections do include the header files available only when those targets are registered.
…183445) This PR modifies gpu.shuffle lowering so only conduct the width check when the subgroupsize attribute is available.
Adds initial support for generic to category linalg morphism. Only conversion to contraction op is supported for now.
These currently have the "fast" flag on the fcmp, but not the select. The transform actually needs it (or more specifically the nsz flag) to be on the select for correctness, but due to an implementation bug it's currently accepted on the fcmp as well. I don't believe the intent of any of these tests is to test specifically the "fast fcmp with non-fast select" situation, so add the missing flag to the select instructions.
Canonicalize GEP source element types from `%T` to `[sizeof(%T) x i8]`. This is intended to flush out any remaining places that rely on GEP element types, as part of the `ptradd` migration. The impact of this change is expected to be fairly minimal (we might enable a few more hoist/sink style folds that depend on equal GEP types).
-march=hexagon uses the default target triple and changes the arch part of hexagon. On linux-musl, this essentially becomes hexagon-unknown-linux-musl which has different code generation. Use -mtriple instead. Link: llvm/llvm-project@9441103 Link: llvm/llvm-project#48936
The unresolved SYCL kernel call stmt class was added in a different patch that didn't deal with CIR. This patch adds it to the list in teh correct spot, which is an unreachable anyway.
CONFLICT (content): Merge conflict in clang/lib/Driver/ToolChains/Clang.cpp CONFLICT (content): Merge conflict in clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Without this change, passing -fthinlto-index causes -fpass-plugin arguments to be ignored. We want to be able to use plugins with distributed thin-lto, so add support for this.
We want to add some basic precommit CI for `libsycl`, similar to what we have for `SPIR-V`. Here it just builds `libsycl` and runs `check-sycl`, but only non-GPU tests will be run because this job is run on GitHub-hosted runners which don't have a GPU, so we will never run GPU tests in this CI job. Postcommit already runs SYCL GPU tests. We have runtime GPU detection as part of the `check-sycl` lit setup so everything works fine. Currently there is only one `check-sycl` test at all and it is a GPU test, so `check-sycl` is basically a no op, so this is de-facto build only. --------- Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
Attempt to fix forward a test failure after llvm-project#183302, which seems to be caused by reusing build directories for test inferiors in LLDB API tests.
The source_set target defined for `llvm/lib/Support/BLAKE3` has assembly files that are specific to x64 platform. Adding the relevant conditional for this target. Signed-off-by: Gowtham Tammana <g.tammana@samsung.com>
…ely]] if (#184684)
Following the PR #181878 I have noticed a false negative when if is
attributed.
Repro:
```cpp
void f()
{
if (true) {
return;
} else {
// Warns as expected
}
if (true) [[likely]] {
return;
} else {
// False-negative
}
}
```
Godbolt: https://godbolt.org/z/cvGdovjhx
Add an overload of isDereferenceableAndAlignedInLoop that directly takes the pointer and element sizes as SCEVs. This allows using it from contexts without relying on an underlying load instruction in follow-up patches.
…#185326) Follow-up to #184253. Update tests that checked for the old double-space output of NVVM ops using ReductionKindAttr, ShflKindAttr, and LoadCacheModifierAttr. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…185325) Follow-up to #184253. The ODS attr/type printer fix removed the leading space from generated print() methods. Update tests that checked for the old double-space output of GPU ops using GPU_DimensionAttr and GPU_MmaElementwiseOpAttr. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
These transforms are now handled in DAGCombine, so enable hasAndNotCompare for all scalar cases on X86, and remove the platform-specific code that does the same thing.
This patch translates the Flang AST to the OpenMP dialect for the affinity clause, including support for the iterator modifier. 2/3 in stack for implementing affinity clause with iterator modifier 1/3 #182218 2/3 #182222 3/3 #182223
…(#185324) Follow-up to #184253. Update tests that checked for the old double-space output of gpu.block_id using GPU_DimensionAttr. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…(#185327) Follow-up to #184253. Update tests that checked for the old double-space output of GPU and NVVM ops using GPU_DimensionAttr and SetMaxRegisterActionAttr. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This PR adds latency/throughput for all RVV mask to the andes45 series scheduling model.
PR #180242 added reserve-r support across the driver and backend, but it also introduced avoidable compile-time work in hot paths. In Clang, delay +egpr detection until -ffixed-r16 through -ffixed-r31 are actually queried instead of computing it for every x86_64 invocation. In LLVM, store X86Subtarget::ReservedRReg in a fixed-size std::bitset and update X86RegisterInfo::getReservedRegs() to iterate only over the reserve-r register ranges instead of scanning every target register. These changes keep reserve-r behavior unchanged while trimming the extra compile-time overhead introduced by the PR. Signed-off-by: ZhouGuangyuan <zhouguangyuan.xian@gmail.com>
This adds a singular Builtin dialect version for use with bytecode serialization. This version is not currently print unless set and not 0 (not planned a bump until next LLVM version). Created a unit test as this was easiest way to track. Additionally add emitWarning virtual method to DialectBytecodeReader, mirroring emitError. Tested on old mlir-opt reader, and could read, so should be non-breaking change.
…337) This patch fixes two crashing reports. Close #185155 Close #185274
Adds `nvvm.fma` Op to the NVVM dialect to perform fused multiply-add operations. PTX ISA Reference: 1. https://docs.nvidia.com/cuda/parallel-thread-execution/#floating-point-instructions-fma 2. https://docs.nvidia.com/cuda/parallel-thread-execution/#half-precision-floating-point-instructions-fma
… offset (#185167)
Extends `vector_contract_to_packed_type_dot_product` transform pass to
include `args` offset check while validating the `vector.contract`.
Eg: `vector.transfer_read %arg1[%arg3, %c0], %0 {in_bounds = [true,
true]} : !memref, !vec`
Spill pseudo opcodes don't require target reg class alignment constraint. For targets which do have alignment constraints, lower the spills to 32-bit accesses. Update the machine verifier accordingly. Sgpr spill pseudos didn't enforce alignment constraints. Modify vgpr spills reg class to not enforce them either.
…g for VF and UF. (#181252)"" This reverts commit 6aa115b. This is causing crashes. See #185345 for details.
Fixes - [#181278](llvm/llvm-project#181278) This patch fixes a crash in Flang when parsing array constructors like: `[ty0(2)(4)]` The current implementation parses this as a type constructor ty0(2), followed by what appears to be another call (4), instead of rejecting it as invalid syntax. The lowering of` StructureConstructor` attempts to retrieve the parent derived type using `sym->owner().derivedTypeSpec()`, which return `nullptr` for PDT cases and lead to a crash. In` flang/lib/Lower/ConvertConstant.cpp`, a safeguard is being added which ensures that we fall back to the constructor’s derived type specification when the parent type cannot be obtained, preventing the null dereference and eliminating the crash. This change addresses only the immediate crash, proper diagnostic handling for this invalid syntax is still pending and remains as TODO. --------- Co-authored-by: Jay Satish Kumar Patel <kumarpat@pe31.hpc.amslabs.hpecorp.net>
…(#184431) When `DIM` is passed as an optional dummy argument and is absent at runtime, the HLFIR lowering for the `CSHIFT` and `EOSHIFT` intrinsics treated it as unconditionally present. This resulted in an unconditional load of the `DIM` reference, causing a null pointer dereference and a runtime segmentation fault when absent. The underlying issue was that the `dim` argument for `cshift` and `eoshift` was not marked with `handleDynamicOptional` during intrinsic argument lowering setup. As a result, the `isPresent` state was never populated, and the lowering implementation incorrectly fell through to an unconditional scalar load. This patch resolves the issue by: 1. Updating the `dim` entries for `cshift` and `eoshift` in `IntrinsicCall.cpp` to use `handleDynamicOptional`. This enables `getOperandVector()` to appropriately emit a guarded load (via `loadOptionalValue()`) that safely returns a 0 placeholder when `DIM` is absent. 2. Updating the HLFIR lowering implementations (`HlfirCShiftLowering` and `HlfirEOShiftLowering`) to use the loaded scalar. It now employs an `arith.select` to substitute the 0 placeholder with the standard-mandated default of 1 when `isPresent` is false, matching the Fortran requirements (§16.9.68 and §16.9.77) without generating redundant `fir.if` or `fir.load` operations. Explicit `DIM=0` calls still correctly forward the 0 value to flang-rt to trigger the appropriate runtime bounds check error. Co-authored-by: Sairudra More <moresair@pe31.hpc.amslabs.hpecorp.net>
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CGExprAgg.cpp
Cherry-pick upstream commit a3a15f3 which moves libclc from LLVM_ALL_PROJECTS to LLVM_DEFAULT_RUNTIMES. Update configure, build and deploy to enable libclc runtime build. jira: CMPLRLLVM-73202 (cherry picked from commit f3962f6) Also cherry-pick from #21403 to w/a libclc-remangler ABI mismatch on RHEL 8. This PR is temporary fix to unblock sycl-web and I'll follow-up in sycl branch to remove libclc-remangler tool.
Replace .ll files with .cl implementations using the __cl_clang_non_kernel_scope_local_memory extension for both amdgcn-amdhsa and ptx-nvidiacl targets.
CONFLICT (content): Merge conflict in llvm/utils/git/requirements_formatting.txt
…s (#182667)
[Clang][ItaniumMangle] Fix recursive mangling for lambda init-captures
Mangle computation for lambda signatures can recurse when a call
operator type
references an init-capture (for example via decltype(init-capture)). In
these
cases, mangling can re-enter the init-capture declaration and cycle back
through
operator() mangling.
Make lambda context publication explicit and independent from numbering
state,
then use that context uniformly during mangling:
* Publish lambda `ContextDecl` in `Sema::handleLambdaNumbering()` before
numbering, so dependent type mangling can resolve the lambda context
without
recursing through the call operator.
* Introduce `CXXRecordDecl::setLambdaContextDecl()` and remove
`ContextDecl`
from `CXXRecordDecl::LambdaNumbering`.
* Update `ASTImporter` to import/set lambda context separately from
numbering.
* In Itanium mangling, derive init-capture handling from context
computation:
- map local-lambda init-captures to the enclosing local context in
`getEffectiveDeclContext()`
- support init-capture variables in `getClosurePrefix()`
- keep `mangleLocalName()` generic and rely on the computed context
Add mangling regression coverage in mangle-lambdas.cpp, including:
* local init-captures used through decltype
* non-local variable-template init-captures in decltype
* non-local static inline member init-captures in decltype
* Fixes llvm/llvm-project#63271
* Fixes llvm/llvm-project#86240
* Fixes llvm/llvm-project#139089
| run: | | ||
| ./llvm/utils/release/github-upload-release.py \ | ||
| --token ${{ github.token }} \ | ||
| --release ${{ inputs.release-version }} \ |
Check failure
Code scanning / zizmor
code injection via template expansion Error
| name: Test SYCL | ||
| runs-on: ubuntu-24.04 | ||
| container: | ||
| image: ghcr.io/llvm/ci-ubuntu-24.04:latest |
Check failure
Code scanning / zizmor
unpinned image references Error
| name: Test SPIR-V | ||
| runs-on: ubuntu-24.04 | ||
| container: | ||
| image: ghcr.io/llvm/ci-ubuntu-24.04:latest |
Check failure
Code scanning / zizmor
unpinned image references Error
| container: | ||
| image: ghcr.io/llvm/ci-ubuntu-24.04:latest | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
Check warning
Code scanning / zizmor
credential persistence through GitHub Actions artifacts Warning
| container: | ||
| image: ghcr.io/llvm/ci-ubuntu-24.04:latest | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
Check warning
Code scanning / zizmor
credential persistence through GitHub Actions artifacts Warning
| repo = github.Github(auth=github.Auth.Token("${{ github.token }}")).get_repo("${{ github.repository }}") | ||
| pr = repo.get_pull(${{ github.event.issue.number }}) | ||
| comment = pr.get_issue_comment(${{ github.event.comment.id }}) | ||
| add_text = "> _Running benchmarks in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}_" |
Check notice
Code scanning / zizmor
code injection via template expansion Note
| run: | | ||
| digest_file="sha256" | ||
| echo "$INPUTS_DIGEST -" > $digest_file | ||
| cat ${{ steps.download-artifact.outputs.download-path }}/* | sha256sum -c $digest_file |
Check notice
Code scanning / zizmor
code injection via template expansion Note
| - name: Rename attestation file | ||
| shell: bash | ||
| run: | | ||
| for f in ${{ steps.download-artifact.outputs.download-path }}/*; do |
Check notice
Code scanning / zizmor
code injection via template expansion Note
| shell: bash | ||
| run: | | ||
| for f in ${{ steps.download-artifact.outputs.download-path }}/*; do | ||
| cp ${{ steps.provenance.outputs.bundle-path }} $(basename $f).jsonl |
Check notice
Code scanning / zizmor
code injection via template expansion Note
| --token ${{ github.token }} \ | ||
| --release ${{ inputs.release-version }} \ | ||
| upload \ | ||
| --files ${{ steps.download-artifact.outputs.download-path }}/* *.jsonl |
Check notice
Code scanning / zizmor
code injection via template expansion Note
No description provided.