[pull] main from llvm:main - #1685
Merged
Merged
Conversation
…212214) If we need to generate a trunc then we can use an integer type for the lowering.
Improve dangling value tracking in the `DanglingPtrDeref` checker by adding `trackExpressionValue`. The report with this change now tracks the dangling value and shows where the value originated from. Currently the checker only points at the destruction and use sites which isn't always useful for the user.
…211941) We were violating the property expressed in MachineFunction.h: ``` The properties are stated in "positive" form; i.e. a pass could require that the property hold, but not that it does not hold. ``` Resolves a false positive "MBB has allocatable live-in, [...]" error in our downstream target.
This patch implements the support for byte types. The byte order depends on the endianness for better performance in the fast path. For non-byte-sized byte types, high bits are zeroed out.
…211354) Assisted by: Claude Sonnet 4.6 --------- Co-authored-by: Adam Siemieniuk <adam.siemieniuk@intel.com>
…l recurrence (#211916) The function `matchConditionalRecurrence` iterates over both PHI inputs and attempts to match each one to determine which is `Start` and which is `Step`. However, some of the failure conditions in the loop `return false`, which has the potential to classify some valid CRC loops as not having a conditional recurrence. The loop here is not really needed at all-- instead, use `L.getLoopLatch()` to determine `Start`/`Step`, since the incoming value from the latch block will always be the `Step`. This also avoids the aforementioned false negative classifications. Assisted-by: Claude Opus 5
So we can easily differentiate between different cluster kinds on AArch64 backend.
…210461) When targeting aarch64-pc-windows-msvc, clang laid out a base following an over-aligned, non-standard-layout base at the wrong offset. MSVC on Arm64 reuses the over-aligned base's tail padding for the subsequent base, but clang rounded the base up to a full slot, so the two disagreed on member offsets, breaking interop between clang- and MSVC-built binaries. Fix: store each record's natural non-virtual alignment (excluding `alignas`/`__declspec(align)` over-alignment) as `getNonRequiredNVAlignment()`, and on Arm64 fold in a base's natural alignment rather than its full alignment. This is gated to Arm64 only; Arm64EC and x64 follow the x64 rule (no reuse) and are unchanged. Validated against MSVC (Hostx64\arm64\cl.exe /d1reportSingleClassLayout): clang now matches MSVC Arm64 exactly for the reduced repro, the original polymorphic case (vftable + empty base + template), and a range of probe cases covering natural vs. over-alignment padding and field vs. base reuse. Arm64EC and x64 output is byte-identical to before. Fixes #210174
…hs (#206400) Co-authored-by: Igor Wodiany <dev@wodiany.com>
PseudoProbeRewriter builds sizable data structures and then hold onto them after they are needed. PseudoProbeRewriter::postEmitFinalizer() parses the input .pseudo_probe sections into an MCPseudoProbeDecoder whose address-to-probe and GUID-to-function-desc maps can be very large (tens of GiB on big binaries with many probes). This is not used again once probes have been updated, yet they survive into the memory-heavy DWARF rewrite (updateDebugInfo), directly inflating BOLT's peak RSS at the worst possible time. This frees them at the end of the postEmitFinalizer() calls, before updateDebugInfo runs. Stacked on top of the .dwo DIE diff, in large binaries you should observe ~17% peak RSS wins if your build uses pseudo probe maps.
) Summary: BOLT can create a jump table object from a PC-relative operand reference (e.g. leaq JT(%rip)) whenever the referenced memory looks like a PIC jump table -- see BinaryContext::handleAddressRef. This is independent of whether BOLT recognizes the indirect jump dispatch itself. The jump table annotation is only attached to the jmp instruction later, in BinaryFunction::analyzeIndirectBranch, and only when the target-specific analyzeIndirectBranch matcher recognizes the dispatch pattern. If the matcher does not recognize the pattern, the annotation is never attached to the jmp, even though the jump table object and its entries exist and reference basic blocks in the function. In strict mode BOLT still fully processes such a function: it stays simple, the block is marked as having unknown control flow, and the jump table object is kept intact. Because the terminator carries no jump table annotation, BinaryBasicBlock::hasJumpTable() returns false for it. Later passes then transform the function normally: remove-nops can empty a jump table target block that consists only of nops, and NormalizeCFG then redirects the block's predecessor and deletes the empty block - it does not recognize the block as a jump table target, since the predecessor's hasJumpTable() is false. The jump table object still references the deleted block by label, which produces an "Undefined temporary symbol" error and fails emission. Fix NormalizeCFG so it does not redirect/remove a block whose predecessor ends in an indirect branch, not only one flagged by hasJumpTable().
PR #205224 changed the path for kernels with no arguments to not use appendLaunchKernelWithArgs, while at the same time it removed zeKernelSetGroupSize which resulted in incorrect sizing of the kernel. This PR removes the alternate path and makes sure all launches go through appendLaunchKernelWithArgs. Alternatively we can restore zeKernelSetGroupSize on the alternate path.
…gers (#212321) Currently, the `OptionalUnsigned(int) = delete;` constructor means that constructing e.g. an `OptionalOrUnsigned<uint64_t>` from an `unsigned` fails because overload resolution is ambiguous (because `unsigned` -> `int` and `unsigned` -> `uint64_t` are both valid conversions). This patch adds a constraint to make sure the deleted constructor only catches signed integer types. This is needed for #212319.
…211933) Renames packed instruction helper functions to better reflect their purpose: - isPackedFP32or64BitInst → isSingleSGPRReadInst - isLegalGFX12PlusPackedMathFP32or64BitOperand → isLegalSingleSGPRReadInstOperand
…stant under unified mode (#212344)
…2339) With the introduction of offloading via LLVM, the frontend language will not necessarily determine the backend target anymore. Thus it is necessary to guard against NVPTX instead of CUDA, since we could have CUDA-language device code targeting a non-NVPTX backend, where Clang does not provide __syncthreads as an NVPTX builtin and the generic shim is still needed. This also avoids duplicate definitions on NVPTX. Clang already provides `__syncthreads` as an NVPTX target builtin, so `__clang_gpu_device_functions.h` should not also define an inline `__syncthreads` shim for NVPTX targets.
The LNT instance on http://lnt.llvm.org was wiped since I created the original schema, and we can now start over clean with a new test suite named `libcxx`.
This PR adds the `UsedByAtomic64` shader flag. It detects any usage of an atomic instruction with a 64 bit type, and if detected, sets the shader flag to true. This is needed to pass DXIL validation. Fixes #104392 Assisted by: Github Copilot
Foundation's small value inline representations have valid summaries and sometimed synthetic children, but LLDB cannot access any ivars from their base classes (such as [NSObject isa]). Use a synthetic child provider to hide them. rdar://182434208 Assisted-by: claude
Switch to using dag predicates instead of free-form code predicates. Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
#212346) …raints The IntegerSet constructor of FlatLinearValueConstraints asserts when flattening fails, which happens for semi-affine integer sets. Since the failure is signalled from inside a constructor, callers have no way to detect the unsupported case ahead of time and no way to work around it; they simply crash. Add an optional `bool *error` parameter to the constructor. When it is non-null, hitting the unimplemented case sets `*error` to true and returns instead of asserting, letting callers bail out gracefully. `*error` is set to false on success. When the pointer is null the previous assert behavior is retained, so existing callers are unaffected.
This patch adds (work in progress) documentation for the various self-hosted runner groups we have access to in the LLVM monorepo.
Both handleUncountableEarlyExits and the countable early-exit disconnect in handleEarlyExits walk all exit blocks and skip predecessors coming from the middle block to find the early exiting blocks. Factor that walk out into vputils::getEarlyExits, returning the (early exiting block, exit block) pairs.
An external layout source (such as LLDB reading DWARF) supplies a record's final alignment directly, since `alignas` / `__declspec(align)` attributes are not recoverable from debug info. `finalizeLayout` captured `NonRequiredAlignment` before applying the external alignment, so an externally laid out record published a stale, too-small value. On Arm64 this field is used to fold a base's alignment into the derived record, so a derived class picked up the stale value instead of the base's actual alignment. This regressed `lldb/test/API/lang/cpp/alignas_base_class` when #210461 was merged, where `alignof(Derived)` evaluated to 1 instead of 8. Other targets were unaffected as they do not read this field. Treat all of an externally supplied alignment as non-required, as there is no way to tell how much of it was imposed by an alignment attribute.
…skew (#212320) Resolve cuDevicePrimaryCtxGetState via the installed driver version, and prefer running scope-exit cleanup when the probe cannot prove teardown, so local device allocations are not leaked when the unversioned lookup fails.
Patch creates dummy source modifiers for this instruction to use with OPSEL. Even though these do not support modifiers we can reuse the same mechanics as with packed fp64 and other u64 to allow scalar operands.
This reverts commit ce8cf3f (#207046). Reland of #204669. https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#code-models says that under the small code model rodata + text must fit in 2GB, but the RelLookupTableConverter pass introduces PREL32 relocations from .rodata to .data.rel.ro: ``` $ cat /tmp/a.c extern void ext_func0(void); extern void ext_func1(void); typedef void (*func_t)(void); static const func_t table0[2] = { ext_func0, ext_func1 }; static const func_t table1[2] = { ext_func1, ext_func0 }; static const func_t table2[2] = { ext_func0, ext_func0 }; static const func_t table3[2] = { ext_func1, ext_func1 }; const func_t *get_table(unsigned int idx) { switch (idx % 4) { case 0: return table0; case 1: return table1; case 2: return table2; case 3: return table3; } return table0; } $ clang -O2 --target=aarch64-linux-gnu -fPIC -c /tmp/repro.c -o /tmp/repro.o $ llvm-readelf -r /tmp/repro.o ... Relocation section '.rela.rodata' at offset 0x370 contains 4 entries: Offset Info Type Symbol's Value Symbol's Name + Addend 0000000000000000 0000000500000105 R_AARCH64_PREL32 0000000000000000 .data.rel.ro + 0 0000000000000004 0000000500000105 R_AARCH64_PREL32 0000000000000000 .data.rel.ro + 14 0000000000000008 0000000500000105 R_AARCH64_PREL32 0000000000000000 .data.rel.ro + 28 000000000000000c 0000000500000105 R_AARCH64_PREL32 0000000000000000 .data.rel.ro + 3c ... ```
The ability to link in and eagerly inline a specified runtime was present in older dev versions of the instrumentor. This patch ports that functionality to the current instrumentor pass and adds a test. Co-authored-by: Johannes Doerfert <johannes@jdoerfert.de> Co-authored-by: Kevin Sala <salapenades1@llnl.gov> Co-authored-by: Ivan Radanov Ivanov <ivanov.i.aa@m.titech.ac.jp>
…guments (#212356) A class-type non-type template parameter is represented in the AST by a TemplateParamObjectDecl, which has an empty DeclarationName. USRGenerator had no visitor for it, so it fell through to VisitNamedDecl, where EmitDeclName fails on the empty name and sets IgnoreResults. That discarded the USR of the enclosing declaration. Add a visitor that encodes the parameter object's type and value, so specializations on distinct values get distinct USRs and equal values agree. Fixes #212351
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 : )