Repository navigation
[pull] main from llvm:main - #1915
Merged
Merged
Conversation
The instrumentation runtime's diagnostics reserve a 32 KiB scratch buffer on the stack. When `assert()` or `reportNumber()` get inlined into callers on instrumented code paths, the buffer inflates every caller frame — on small thread stacks a single such frame already overflows the guard region and the profiled binary segfaults even when no assertion fires. Move the `assert()` failure path into a `noinline` helper (`reportAssertFailure`) and mark `reportNumber()` `noinline` as well, so the scratch buffer is only reserved when a diagnostic is actually emitted. This matches the fix sketched in the issue report. Verified: `common.h` syntax-checks clean in the freestanding runtime build; the only behavioral change is where the buffer lives. Fixes #225479 AI assistance: AI tools helped prepare this contribution. The author reviewed the final patch and remains responsible for it, in accordance with the LLVM AI Tool Use Policy.
…esult (#227389) The second result of `ISD::VP_LOAD_FF` is the new EVL, which is always less than or equal to(1) the EVL operand of this intrinsic, and (2) the largest length of the loaded vector. This patch teaches computeKnownBits about these ranges so that DAGCombiner can eliminate things like redundant z/sext + truncate on this new EVL. In RISC-V, this means that if there are two consecutive fault only first loads where the second one is using the EVL from the first load, there won't be any redundant zext + truncate generated for the intermediate EVL in between.
Avoid materializing matrix operands in the hlsl.ewcast.src temporary when performing matrix-to-vector elementwise casts. Extract each element directly from the canonical matrix SSA value using its column-major flattened index. Factor vector result construction into a shared helper so aggregate and matrix sources use the same conversion and insertion logic. Update the matrix-to-vector CodeGen checks for both row-major and column-major layouts. Assisted by Copilot using GPT 5.6 Sol
Previously, CompressInstEmitter only handled plain Register and RegisterClass records when matching and validating operands in CompressPat definitions. Attempting to use a RegisterByHwMode (such as a mode-dependent stack pointer) or a RegClassByHwMode with mode-dependent registers failed because CompressInstEmitter could not resolve the underlying register or register class for a given subtarget configuration. Introduce HwModePredicates in CodeGenHwModes to resolve HwModeSelect records using the subtarget features required by a CompressPat (with predicates implying the absence of all non-default modes resolving to DefaultMode). This allows using a single instruction definition for compressed instructions like RISC-V C_ADDI4SPN/C_ADDI16SP across HwModes instead of duplicating the instruction definitions for each mode. This commit was created with the help of AI tools
Add tests that check that JIT'd C code can call functions, both in the same object and in other objects: direct calls, calls through function pointers stored in initialized data, and tail calls. The tail call tests only run at -O2, since an unoptimized build may not emit tail calls.
) Tracking issue: #201242 See the [migration guide] for more information. [migration guide]: https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines This is the initial straight rename commit. It will probably break the docs build, but it has to be a separate PR for blame preservation purposes.
…222064) This is the second batch of changes to migrate libc++ documentation from rst to markdown. I use a local pixel diff tool to compare the rendered HTML, and all diffs seem like fixes. They tend to fall into the following categories: - dashed bullet lists were previously not rendered, but now they are - extra indentation interpreted as blockquotes has been removed - single backticks are now codefont spans, not italic spans Tracking issue: #201242 See the [migration guide] for more information. [migration guide]: https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines This is a stacked PR based on #222062, which will be a standalone commit that renames *.rst -> *.md before this PR lands for history preservation purposes.
) The PythonRuntimeLoaderDarwin is responsible for finding the Python library at runtime. Previously, this was using `DEVELOPER_DIR` and `xcrun` to avoid having to hard-code the same list of relative paths that we have as RPATHs for the non-dynamic interpreter build. However, that leads to some tricky behavior when launching `lldb` with our without `xcrun`. Combined with some odd path combinations, I changed my mind and went back to mimicking the RPATH approach. While I was at it, I also dropped the fallback for looking for Python in /Applications/Xcode.app. That was always a hack, and now that we support falling back to a Homebrew or Pyhthon.org installed Python.framework, I think we should just rely on that. rdar://188746227
…227479) On targets with BF16InlineConstFromUpperFP32, an inline constant on a packed bf16 instruction is expanded to FP32, so only a splat is encodable and both lanes must use op_sel to read the upper half. Scalar bf16 math lowers to V_PK_* with a dead high lane, so the constant arrived as (scalar_to_vector bf16:c), which is not a splat yet still looked inlinable and got folded without op_sel, reading the wrong half. Combine (scalar_to_vector bf16:c) into a splat BUILD_VECTOR when c is an inlinable bf16 constant on such subtargets, and in SIFoldOperands disable the V2BF16 folding paths that would inline a literal without op_sel. Also allow op_sel_lo on src1 in isOMod() for V_PK_MUL_BF16 so omod folding still applies. Fixes: LCOMPILER-2879 and ROCM-30938
We recently merged some fixes for the test suite which should make the comparisons more meaningful. Since we haven't re-generated anything since the recent LNT machine bumps, re-bumping now should not cause any churn.
The Language Environment startup routine `CELQSTRT` finds the main
routine and its environment through `CELQMAIN`. clang does not emit it;
the driver links with `-u CELQMAIN`, which pulls the copy from
`SCEEBND2`. That copy is in NORENT format and refers to the symbol
`MAIN`, so a program built with clang does not start (U4093 reason 218,
or a protection exception because no WSA is allocated and the ADA offset
is used as an absolute address).
For a module that defines `main`, emit `CELQMAIN` in RENT format as
described in "z/OS Language Environment Vendor Interfaces", chapter
"Program initialization and termination for AMODE 64 applications", plus
a reference to the bootstrap routine `CELQBST`, which `CELQSTRT` only
references weakly. `CELQMAIN` gets OS linkage, because `CELQSTRT`,
`CELQINPL` and `CELQBST` reference it with OS linkage (otherwise the
binder reports IEW2469E).
With this change `int main(void) { return 42; }` bound with `ld -e
CELQSTRT` against `SCEEBND2` and the LE side decks, and no other
objects, returns 42 on z/OS 3.1.
Tests: new `zos-celqmain.ll` and `zos-celqmain-nomain.ll`; `llvm-lit
test/CodeGen/SystemZ test/MC/SystemZ test/MC/GOFF` passes (1305 passed,
19 unsupported).
The comment in `GOFFObjectWriter.cpp` mentions `emitCELQMAIN`; if an
implementation is already planned upstream, I am happy to close this.
Assisted-by: Claude Code (Anthropic)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Move the tests out of same-object/ and cross-object/ subdirectories into addressing/, and mark tests of references to entities in other objects with a -cross-obj suffix. This keeps the variants of a construct together, e.g. global-function-call.c next to global-function-call-cross-obj.test, so gaps in coverage are easier to spot.
A recent commit 9a0c255 introduced dependency on llvm-dis to compiler-rt test instrprof-thinlto-indirect-call-promotion.cpp. This caused error "llvm-dis: command not found" in CI testing. Fix by adding llvm-dis to the dependency list for compiler-rt test.
Fixes #226251 Require row_major and column_major modifiers to apply directly to a matrix type rather than accepting an array typedef whose element type is a matrix. This preserves valid declarations of arrays of annotated matrix elements while rejecting attempts to apply a layout modifier to the array type itself.
AArch64 local-exec TLS code sequences compiled with -mtls-size=12 use the non-NC R_AARCH64_TLSLE_ADD_TPREL_LO12 relocation (emitted for 'add xN, xN, :tprel_lo12:sym'), but lld only handles the _NC variant, so linking such objects fails with 'unknown relocation'. Add the relocation to the TLS LE group in scanSectionImpl (R_TPREL, same group as the other TLSLE relocations, so it is also rejected for -shared) and resolve it like the _NC variant, but with an unsigned 12-bit range check as the non-NC form requires the full offset to fit into the imm12 field.
) Fold: ``` (-X) / (-Y) -> X / Y ``` Do not combine when X may be INT_MIN and Y may be -1, as the result could introduce signed division overflow. For AMDGPU example: https://godbolt.org/z/6jj6E8T5T
This PR extends the RISC-V TTI cost model to recognize `llvm.vector.interleave2` and `llvm.vector.deinterleave2` when the Zvzip extension is available. The cost is computed based on the operand that holds the interleaved data: the destination operand of `vzip.vv`, and the source operand of `unzipe.v` or `unzipo.v`. This is the first PR split out from #224991. Assisted-By: Trae CLI (GPT-5)
opt and llc load -load-pass-plugin plugins from a cl::opt callback while parsing argv, so that the options a plugin registers are recognized later on the command line. cl::callback is to be removed to enable migration to a TableGen-based option representation (https://discourse.llvm.org/t/rfc-declare-library-command-line-options-in-tablegen-one-struct-per-library/91877/5). Load plugins after cl::ParseCommandLineOptions. A loaded plugin's options are no longer accepted as ordinary options; pass them with -plugin-arg=<plugin>,<arg> instead. Prefix each Polly option in Polly tests with -plugin-arg=Polly, and each IRTransforms example option with -plugin-arg=SimplifyCFG,. LLM-aided
Summary: Two small tweaks. First, the allocator creates memory for the type via placement new, but does not deallocate it with the destructor. This is UB and is fixed by explicitly callling the type's destructor. Second, the plugins were only 'released', which was likely just being confused with `reset`. Release returns the pointer, essentially giving up ownership, but we never take the pointer so it just dangles. The correct spelling is 'reset'.
Model pair-even and pair-odd shuffle costs using vpaire.vv and vpairo.vv when the Zvzip extension is available. Add a new file `RISCVVectorUtils.h` to share shuffle-mask helpers between ISel lowering and TTI. Also move `isPairEven` and `isPairOdd` into the new file and reuse them in TTI. This is the second PR split out from #224991. Assisted-by: TRAE CLI (GPT-5)
The Linux benchmarking machine was still using the llvm-premerge-libcxx-runners runner set, which doesn't exist anymore. Moving to K8s also requires specifying the Docker image to use in machines.json. As a drive-by, drop the manual Python installation since a suitable version of Python should already exist in the image.
Originally found this typo from docs generated by Doxygen.
`BuiltinAtomicOverloaded` returned a bare `ExprError()` on the ARC ownership check and made CodeGen hit `llvm_unreachable`. so return a `RecoveryExpr` instead so bad data can't reach codegen. Fixes #222528.
…yFromReg (#227203) PR #227026 marks every clobber def dead, but a flag output such as X86 `={@ccz}` is lowered to a glued `CopyFromReg $eflags` whose only definition is the `~{flags}` clobber. With EXPENSIVE_CHECKS the verifier reports "Using an undefined physical register" for the SETcc that reads EFLAGS (bittest-intrin.ll, inline-asm-flag-output.ll, pr40737.ll). Don't set the dead flag on a clobber that overlaps a physical register read by a glued CopyFromReg. Aided by Opus 5.5
This improves a few things in the long string code path. Specifically: - The null terminator is copied from the assigned-from string instead of setting it manually - various branches have been removed via `__assume`s that are known - `memmove` is tail-called by updating the pointer and size of the string first and not returning `this` anymore - the allocating path is outlined into a separate function, which basically amounts to manual shrink-wrapping (this should be removed once LLVM is able to do this on its own)
#220177) **Summary:** - Port the classic CodeGen AMDGPUABIInfo call-convention classifier to the new language-agnostic LLVM ABI library. **Changes:** - LLVM ABI library. AMDGPUTargetInfo implements return, kernel-argument, and regular-argument classification. - Unit tests covering the classifier's argument/return branches. Relates to issue: #220471 Pre-requisite PRs: #224994, #225005, #225009 Assisted by: Claude Opus 4.8
…alysis (#224657) `affine-loop-fusion` collects generic memory-effecting operations such as `vector.transfer_read`, but `mayDependence()` later relied on `getMemRef()`, which only handled affine/memref loads and stores and could crash on other memory operations. This change uses the existing memory-effect handling to check memref accesses generically and adds a reduced regression test. Tests: * `build/bin/llvm-lit mlir/test/Dialect/Affine -v` * 73/73 tests passed Fixes #224224. AI Tool Disclosure: AI tools were used to assist the code base exploration and understanding the code design. I independently reviewed every line of the final changes and validated the implementation and tests. Co-authored-by: Purnima Shrivastava <purnimashrivastava05@.com>
#226524) Use `ShapeCastOp`, instead of `ExtractOp` and `BroadcastOp`, to drop the leading unit dimension in `castAwayContractionLeadingOneDim`. This PR continues the work started in: * #208752, #210902, #211777, #219499, #219494 Essentially, this implements the approach already agreed on in the previous PRs. See also #196206, which originally implemented this change and was subsequently reverted in #199546. `TransposeOp`s are left intact in light of the ongoing discussion about whether folding `TransposeOp` into `ShapeCastOp` is valid, see e.g. #219611. Note that in the tests, `TransposeOp`s are nevertheless replaced with `ShapeCastOp`s. This is due to the existing `TransposeOp` folders.
In modern CMake, editing `CMAKE_` variables directly is discouraged. `/Brepro` should be passed via `add_link_options()` with a `LINKER:` prefix to be portable. This fixes issues for downstream consumers like Swift whose linker driver needs the linker arguments to be prefixed. --------- Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
`rvalue_iterator` holds an `it_` member, not an `it`. This issue was found while force-instantiating the template members. In current tests the problematic code seems to be unreachable.
….s (#226945) Add retired POE2 system registers to retired-register-names.s
….py) on Windows on Arm (#227605) This test expects to be sent function names by another thread. Function names are allowed to be null, but the sending thread only sent them when they were non-null. On Windows on Arm, for whatever reasion, all the functions have no name during the test. This is despite lldb being able to show them: ``` * thread #1, stop reason = breakpoint 1.1 * frame #0: 0x00007ff71d191008 inferior_program`int next(void) at inferior.cpp:6:13 frame #1: 0x00007ff71d19107c inferior_program`main at inferior.cpp:13:9 frame #2: 0x00007ff71d1cc994 inferior_program` ``` The test is not about whether we parse debug info properly, and I am not about to dive into that anyway. So I think it's better to adapt the test to only care that some function was found. The function's name is just a token to say that, empty or otherwise.
fcvt.s.h is available with Zfhmin. Use the __extendhfsf2 libcall without it.
Adds file headers according to LLVM Coding guidelines. LLVM's rules don't explicitly require or exclude the header in tests. The C++ runtime libraries (libc++, libc++abi, libunwind, libc) add it anyway. The compiler and offload/openmp test suites mostly don't. Following the footsteps of libcxx. Assisted-by: Claude Code. Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
) Divceil optimization only happens if we can prove x + y - 1 does not overflow. Originally, a SimplifyQuery with no context instruction was passed to checkDivCeilNUW which made it so that the optimization never happened if the bound came from an assume. This meant that even when an assume proved that x + y - 1 did not overflow, the optimization did not happen. This change passes SQ.getWithInstruction(&I) so the range of x is computed at the add being folded, and assumes that apply there are used when deciding whether we can fold. Fixes #220849 AI Disclosure: I used Claude to help explain LLVM concepts while I was trying to understand the problem. It also walked me through syntax, helper functions that I should utilize, good test cases, and general formatting for things like test case comments.
Apply post-commit review changes of #227545. `%loadNPMPolly` is necessary to conditionally load the Polly plugin and not having to repreat a lot of options in each regression test. It cannot be spelled out in each individual test. Apply this change as discussed in #227545 (comment). It could replaced with a tool substitution instead. Also prefer use the default-sized `SmallVector` as by the LLVM programmer's manual: https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h.
Add support for O32, N32, and N64 relocatable ELF objects in both byte orders. Handle O32 implicit addends and HI/LO pairing, N32 relocation groups, and N64 packed relocations. Preserve the MIPS64 ISA triple for N32 while recording its four-byte pointer ABI in LinkGraph. Implement absolute, PC-relative, GP/GOT, and compound fixups, GOT-backed $t9 call stubs, and EH-frame support. Use MIPS-specific GOT keys for target, addend, and exact/page entries, and collect GP-relative content into one ordered region. Support standard MIPS ISAs, including release-6 stubs. Integrate GD/LD TLS with ELFNixPlatform and add an assembly resolver that reads the thread pointer with rdhwr before calling the existing C implementation. Honor explicit MIPS relocation-model requests while retaining the static default. JITLink remains opt-in and RuntimeDyld remains the default. Add focused relocation, ABI, GOT/stub, EH-frame, and TLS tests. Assisted-by: chatgpt-5.6-sol
`TestMinidumpReloadCrash.py` runs `process save-core --plugin-name=minidump` on any architecture, so it fails on 32-bit arm: ``` error: failed to save core file for process to '.../process.core': architecture arm not supported. ``` `ArchThreadContexts::prepareRegisterContext` in `MinidumpFileBuilder.cpp` builds a thread context for x86_64 and aarch64 only, so `AddThreadList` rejects any other architecture. Gate the test like the other minidump save-core tests.
These pseudos may clobber scc, so they need the def on the instruction definition. c16f776 added a let block over the defm, overriding the [EXEC, SCC] defs in the base PseudoInstKill class. With the defs gone, selection was free to leave a compare result in SCC across the kill. #134718 then marked SCC live-in to the split block to satisfy the verifier, which can probably cleaned up. The result is visible in skip-if-dead.ll: in scc_use_after_kill_inst the s_cbranch_scc0 after the kill consumed the exec update's SCC instead of the s_cmp_lg_u32 it was selected for. Pass the extra defs as a multiclass parameter so an override cannot drop the mandatory ones again. Selection now sinks the compare past the kill, so SCC is never live across it and the dead flags from a3cf6f4 are correct as written. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Only include changes after the 23.x release: https://github.com/llvm/llvm-project/blob/release/23.x/polly/docs/ReleaseNotes.rst
…26978) `thread until` and `SBThread::StepOverUntil` turned their targets into addresses using different code. This commit introduces a helper function `GetStepUntilAddresses` to unify behavior and the error message. It resolves lines as `thread until` did: a line without line table entries resolves to the nearest following line with entries. For StepOverUntil, a line that is only the call site of an inlined function now resolves that way too. The wording of errors is that of `thread until`.
Every captured variable was always passed by non-const reference, even when the extracted code never modifies it, resulting in misleading function signatures. Determine, for each captured variable, whether it's ever (possibly) mutated within the extraction zone, and add `const` to the parameter's type when it isn't. Still passed by reference either way, to avoid a copy. The check is folded directly into the existing zone traversal (`captureZoneInfo`'s `ExtractionZoneVisitor`), so its cost stays proportional to the size of the code being extracted. Direct mutations (assignment, increment/decrement, non-const method calls, explicit casts to non-const reference, non-const-reference call arguments, ...) are recognized precisely from each occurrence's immediate syntactic context. Anything that aliases a captured variable (a reference bound to it, its address taken, capture by reference in a lambda, a forwarding-reference call argument, a non-const-ref range-for loop variable) is conservatively treated as a possible mutation, without tracing whether the alias itself is later mutated -- trading a little precision in alias-heavy code for a simple, linear-cost check. Array-typed captures are never made const, since array-to-pointer decay and array-element mutation have enough edge cases that it wasn't worth special-casing for a rare pattern. Assisted-by: Claude
…s paths (#227373) This patch introduces a helper function to strip the extended-length path prefix from windows paths.
…26974) `NativeProcessProtocol::Threads()` returns a `LockingAdaptedIterable` that holds `m_threads_mutex` for the lifetime of the iteration, so callers may hold references into `m_threads` across the loop body. On Windows, this is only done when removing threads: ``` // OnCreateThread m_threads.push_back(std::move(thread)); ... // OnExitThread std::lock_guard<std::recursive_mutex> guard(m_threads_mutex); llvm::erase_if(m_threads, ...); ``` `m_threads` is a `std::vector<std::unique_ptr<NativeThreadProtocol>>`. When the debug-event thread appends and the vector reallocates, every reference held by a concurrent iteration on the main loop dangles. This takes lldb-server down with an access violation: ``` Exception Code: 0xC0000005 #0 NativeThreadProtocol::GetID NativeThreadProtocol.h:40 #1 GetJSONThreadsInfo GDBRemoteCommunicationServerLLGS.cpp:819 #4 Handle_jThreadsInfo #8 GetPacketAndSendResponse #9 DataAvailableCallback :1271 ``` --- This patch takes `m_threads_mutex` everywhere `NativeProcessWindows` touches `m_threads`: when adding threads in `OnDebuggerConnected` and `OnCreateThread`, and when reading them in `Resume`, `StopThread`, `UpdateThreads`, the halt path of `HandleBreakpointException`, and `OnLoadDll`/`OnUnloadDll`.
Namely, initializer lists for primitive types and discarding the result of an initializer list.
…27635) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…227305) To fix test/CodeGen/AArch64/abi-classify-return-types.c. The code path in the existing tests in `test/SemaHLSL/Types/BuiltinMatrix/MatrixConstantExpr.hlsl` don't go though `CheckLiteralType()`, so aren't rejected.
…27636) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )