[pull] main from llvm:main - #5813
Open
pull[bot] wants to merge 597 commits into
Open
Conversation
Baseline tests for #214508
Follow-up to #202232 to also compute costs for truncated inductions in ::computeCost, removing the fallback to the legacy cost model unless the loop is fully unrolled. Note that this changes vectorization decisions in both direction, e.g. * now vectorized `@tail_predicate_without_optsize`: legacy costs <16 x i64>, whereas we generate a narrow IV <16 x i8>, which is much cheaper * no longer vectorized `@second_lshr_operand_zero_via_scev()`: we generate 2 IVs (one truncated and one not truncated), which is more expensive than the single IV LV assumes (note that previously we would ignore the cost of the trunc in the cost computation, because the trunc was replaced by the wide truncated IV, which was assumed free. Both cases are due to more accurate cost computations. PR: #212786
This patch adds initial sched model for Hisilicon's hip12 core (Kunpeng 950 processor).
If the absolute value of Stride is not unit, avoid adding stray SCEV predicates.
…214919) `Float8E8M0FNU` has a precision of 1, so it stores no significand bits and its NaN carries no payload. `IEEEFloat::convert` shifts the (empty) significand into the target format, which leaves the NaN exponent with an all-zero significand — and that is the encoding of an infinity in any format that has infinities. The `APFloat` object still reports `fcNaN`, so `isNaN()` returns true, but `bitcastToAPInt()` hands back Inf bits. Anything that stores the bit pattern rather than the object — `ConstantFP`, MLIR's `FloatAttr` — therefore ends up with an infinity. In MLIR this shows up when folding `arith.extf` on an `f8E8M0FNU` constant. The OCP MXFP spec uses the all-ones encoding as the scale of an invalid block, so this silently replaces "this block is invalid" with a value that poisons everything it is multiplied into: ```mlir func.func @e8m0_nan_to_f32() -> f32 { %c = arith.constant 0xFF : f8E8M0FNU %0 = arith.extf %c : f8E8M0FNU to f32 return %0 : f32 } ``` ``` $ mlir-opt x.mlir -canonicalize %cst = arith.constant 0x7F800000 : f32 // +Inf, not a NaN ``` f16 gives `0x7C00`, bf16 `0x7F80` and f64 `0x7FF0000000000000` — all Inf encodings. `convert` reports `opOK` with `losesInfo == false` in every case. `Float8E8M0FNU` is the only semantics in the table with `precision == 1`, so this is the only source format affected. The fix creates a new NaN in the target semantics when the source has no significand, next to the existing fix-up for `fltNanEncoding::NegativeZero` sources, which handles the analogous NaN-to-`-Inf` case. Verification: exhaustively over all 256 `Float8E8M0FNU` values against f16, bf16, f32, f64 and f128, checking that the category survives, that a NaN never comes out as an Inf, that the stored bit pattern read back through the target semantics is still a NaN, and that finite scales round-trip unchanged where the target's exponent range allows it. Reverting the `APFloat.cpp` hunk makes the new unit test fail.
…213325) Currently computeKnownBits is too conservative with poison inputs.
The arm architecture has different variants (arm64, armv8l e.t.c). We only check if it starts with the arm prefix. Follow up to #210946
As they use clang specific debug information options.
`translateVectorDeinterleave2Intrinsic` used to try to build `G_SHUFFLE_VECTOR` with a scalar result type, which is not valid. This was the case because the LLT that corresponds to the `<1 x float>` IR type is a scalar type, not a vector type. Add a special case for scalar result types to build `G_EXTRACT_VECTOR_ELT` instead. Fixes: #214713
The bottom frame is always created via an `EvalEmitter`, which has its own implementation of the `Ret` opcode. The exception is `Context::Run`/`isPotentialConstantExpr`.
This defends against regressions in future patches. Copies the logic from the IR version of computeKnownBits's handling of ConstantVector. I'm not sure why the IR version doesn't directly return a value for poison, but this follows suit. Co-authored-by: Claude (Claude-Opus-4.8)
re.Pattern was added in 3.7 and our minimum is now 3.8. Python 3.6.15: >>> import re >>> re.Pattern Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 're' has no attribute 'Pattern' Python 3.7.17: >>> import re >>> re.Pattern <class 're.Pattern'> Python 3.8.20: >>> import re >>> re.Pattern <class 're.Pattern'> (it does not appear in documentation until 3.11)
Instead of querying `_LIBCPP_HAS_LOCALIZATION` from Python, do it from the source program. This fixes a bug where if `_LIBCPP_HAS_LOCALIZATION` was not defined at all (which is the case for older versions of libc++), the feature would then be defined immediately, regardless of the platform we're on. That's because `and` has higher precedence than `or` in Python, so we'd end up skipping the `_WIN32` check entirely.
`uadd.sat(X, C) - C --> umin(X, ~C)` for nonzero `C`. The saturating add gives `X + C` or `UMAX`, so subtracting `C` leaves `X` or `UMAX - C`, which is the unsigned minimum. `UMAX - C == ~C`, so the constant is just the inverted `C`. There was already a test documenting this miss in saturating-add-sub.ll (`test_scalar_uadd_sub_const`) - it folds now. https://alive2.llvm.org/ce/z/kLFWy7 Fixes #215103
Our minimum Python is 3.8.
…nderers (#214460) Prep for the following commits, which fix crashes in the analyzer's SARIF and HTML output on ranges that end inside a macro expansion. Fixing them means mapping such a range into the reported file - the normalization the frontend text and SARIF renderers already do, and that the two analyzer consumers each do differently and incorrectly. Hoist that logic into getExpansionRangeInFile, beside the DiagnosticRenderer base both frontend renderers derive from, so the fixes reuse one implementation instead of adding two more copies. TextDiagnostic and SARIFDiagnostic move onto it here with no behavior change; the analyzer consumers follow in later commits. getFileID() replaces SARIFDiagnostic's getDecomposedLoc(...).first - equivalent here, and what TextDiagnostic has used since c113cbb. Assisted-By: claude
PtrTy -> VoidTy
Benchmarking every commit of libc++ is prohibitively expensive: a single run of the benchmark suite takes hours, and the data has to be regenerated from scratch whenever the compiler, the OS or the benchmark machines change. These tools instead sample the history at a coarse granularity and drive libcxx-benchmark-commit.yml to fill in what is missing. Three tools cooperate, meant to be run periodically: select-anchor-commits picks one commit per calendar bucket from Git plan-benchmarks diffs that against what LNT already holds dispatch-benchmarks requests the corresponding workflow runs They keep no state of their own. They recompute the current and target states from LNT and the GitHub Actions API, which allows running them in a CRON. The dispatching of workflows is done using a budget, to avoid launching tens of jobs and competing with other uses of the CI resources. The first pass of these tools was assisted by Claude, but I reviewed and tweaked everything that needed it.
SCS hardcoded r19 as the shadow call stack pointer and required
-ffixed-r19. That was the wrong register to pick: r19 is precisely the
one the intended consumers cannot give up, so the feature was unusable
in practice.
* The Hexagon Linux kernel already reserves r19 for its thread-info
pointer (arch/hexagon/Makefile: "TIR_NAME := r19", documented there as
not configurable because it is hard-coded in several files).
* hexagon-hypervisor reserves r20-r28 (kernel/CMakeLists.txt), with r28
bound to a register global (H2K_gp).
That leaves h2 only r16-r19, so no single hardcoded choice can serve
both consumers.
Intersecting that with the callee-saved regs leaves r1{6,7,8}. So the
new default is r18.
* Add scs-reg-r{16..27} subtarget features
* Add a -mscs-reg=<reg> flag. It's in m_Group instead of
m_hexagon_Features_Group, since the latter is consumed by
handleTargetFeaturesGroup() and would synthesize a bogus "+scs-reg="
feature.
The compiler must emit acc.device_ptr mapping for device values, however, an existing present clause prevents that. A present on a device value always holds, so fold it away to allow implicit data handling to generate device_ptr mapping.
There is no rc in the lit version string, so release candidates get published using the non-rc version number.
The gh-action-pypi-publish action only supports being run once per job. Running it twice results in the second upload always failing. Rather than trying to create a complicated job structure to support uploading to test.pypi.org and pypi.org, we just remove the test.pypi.org upload for now.
…serting an import (#213751) When inserting a header with an `#import` directive, if an existing `#include` directive for the same header and quotation style is found, replace it with the `#import` directive instead of adding a duplicate. This is based on two assumptions: 1. that `#import` outranks `#include` since headers that are included are assumed to have appropriate include guards to prevent multiple inclusions 2. that there is no good reason to have an include and import of the same header in a given source file. Note that this is intended for include-cleaner support for Objective-C.
…ng (#215117) The CallConvLowering bridge accepted only `float` and `double`, so a function taking a `_Complex`, or a float in any other format, failed the pass instead of being classified. An all-float aggregate failed for a different reason: its SSE eightbyte coerces to a vector, and the bridge had no way to represent one, so it reported the coercion NYI rather than emitting a wrong signature. Mapping every CIR floating-point type through `FPTypeInterface` covers all of them at once. A `_Complex` maps to the library's complex type and a vector coercion now converts back to a CIR vector. Accepting a `long double` also makes a union holding one classifiable. That exposes the ABI-compatibility flags, which the pass left at the library defaults. They now come from the triple and the compatibility version, which is what lets a `long double` union reach registers on Darwin instead of memory. `updateArgAttrs` appended argument attributes instead of setting them, so a name already present landed in the dictionary twice. CIRGen marks a `_Complex long double` parameter `llvm.noundef`, and the ABI then passes it byval, which wants `llvm.noundef` too. An integer coercion lost its bit-precise flag coming back from the classifier. A struct holding a `_BitInt(128)` then took `__int128`'s 16-byte alignment for its coerce slot instead of 8. Assisted-by: Cursor / claude-opus-5
…lls (#210963) RuntimeLibcalls should indicate any function that exists and is callable. Historically the list of library functions was conflated with the library functions which should be used, so the library definition was complicated by excluding the overridden cases. My reading of the compiler-rt sources is that the generically named functions are built alongside the __hexagon prefixed variants. e.g., __divsi3 and __hexagon_divsi3 both exist. It will simplify future libcall work the fewer special case target exclusions there are, so allow the functions to be defined and apply the selection preference for the __hexagon prefixed versions in LibcallLoweringInfo. I do question why compiler-rt is built this way; why doesn't the hexagon just replace the standard entrypoint names with the target implementations? Co-authored-by: Claude (Claude-Opus-4.8) <noreply@anthropic.com>
…)" (#215577) This reverts commit 1e774b0. #214215 Broke AMD GPU build. https://lab.llvm.org/buildbot/#/builders/234/builds/1962 I talked with @blazej-smorawski, and he well fix it tomorrow - so for now we should just revert it.
Instead of importing it as reload_module. That name comes from https://reviews.llvm.org/D15209/ 7d2d098. reload_module is what the 2/3 compatibility library "six" called it. In Python 2 "reload" was a builtin and 3 moved it into importlib. We require 3.8 so we don't need to consider 2 anymore.
Besides what's fixed in #205074, the srl(bitcast(build_vector)) fold added in #181412 has another way to create an illegal type: the bitcast to LastElt.getValueType().changeTypeToInteger() is itself illegal when, for example, LastElt is f16 and i16 is not a legal type. Unfortunately, this happens in a downstream target so no testcase.
) The ORDERED directive comes in two flavors, standalone and block- associated. Create two different directive ids, one for each kind. This will allow a more precise connection between the directive id and its properties. This does not remove OMPD_ordered, nor does it change clang or flang beyond the minimum required to keep working as before.
…#214727) Use OMPD_ordered_blockassoc for the block-associated ORDERED directive, and OMPD_ordered_standalone for the standalone variant.
…#214728) Use OMPD_ordered_blockassoc for the block-associated ORDERED directive, and OMPD_ordered_standalone for the standalone variant. This still uses a single AST class for both though. The directive kind stored in can now take either of the two values. --------- Co-authored-by: Alexey Bataev <a.bataev@outlook.com>
It has been replaced by OMPD_ordered_standalone and OMPD_ordered_blockassoc.
Now that OMPD_ordered has been replaced with two variants, split the OMPOrderedDirective class into two classes, one for each variant.
Summary: These are currently all routed through the generic interface. Doing this should safe a handful of instructions and make the intent clearer. Basically, makes it nicer on the optimizer and reduces the number of wait counts while effectively being NFC because this address space is where these always lived. Main rationale, lets you link C++ into OpenCL without requiring flat addressing. Also trims off some SGPRs I think.
) When we had a pointer in an `lldb.value`, we used to use `GetValueAsSigned`. If the sign bit is set, we'd get negative values like in the failed lldb-arm-ubuntu test (#214295 (comment)). With this PR, we use `GetValueAsUnsigned` for pointers to get the unsigned value. I'm not sure if we should use `AsUnsigned` or `AsAddress` here. The difference is that `AsAddress` will clear the top bits. In the test, I'm using `assertEqual(arr_start + 2, arr[1].sbvalue.GetLoadAddress())`, but as far as I know, `GetLoadAddress` will not clear any bits(?)
…213075) `DebuggerThread::m_active_exception` and `m_exception_pred` are accessed both from the Windows debug-event loop and from the thread driving the debugger. There is no sync mechanism between the two. That caused 2 failures. 1. Use after free: The `m_active_exception.reset()` in `ContinueAsyncException()` can destroy the exception while the delegate uses it. 2. `ContinueAsyncException()` can be called between the end of the delegate and `SetValue(result)`. Causing `WaitForValueNotEqualTo(BreakInDebugger) to spin forever`. This patch guards `m_active_exception` with a mutex and returns a `ExceptionRecordSP` from `GetActiveException()` so callers no longer have to lock a weak_ptr. To verify this, I ran the test suite and injected a 50ms delay into the window between the delegate returning and the `SetValue()`. This reproduces the packet timeout in `TestGdbRemoteExitCode` deterministically before this change, and all lldb-server tests pass with the same delay after it.
Since RISC-V has zero-extending loads (lbu/lhu), we can pattern match zext-of-load into a single instruction. Often load and the zext/sext are separated by select and / or phi instructions. In the future we want to "push back" the zext instructions so they are next to the loads. This PR precommits tests for this optimization. Assisted by AI.
Add a new `LLVMOffloadKernel` shared library under `offload/languages/kernel`. This introduces the core kernel-language runtime used by higher-level CUDA/HIP language entry points. The CUDA and HIP runtime shims are built into `LLVMOffloadKernel`, so this PR produces a single offload language runtime library rather than separate CUDA and HIP libraries. The new library is built as part of the offload runtime tree and installed with the existing offload install. Unit tests for these changes are added in #212373 since it relies on the frontend integration as well Assisted by GPT-5.5, checked and reviewed manually Co-authored-by: Johannes Doerfert <jdoerfert.llvm@gmail.com> Co-authored-by: Jonas Greifenhain <cadivus@daverkomp.de>
…15435) A Clang module compile unit carries the only definitions of the types its module owns. No definition in it is reachable from a live address. Similar to the classic linker, we need to mark everything as kept. rdar://184559034
Connecting to a remote platform through port forwarding can fail transiently even when the device and the tunnel are healthy, which aborts the entire test suite run before a single test executes. Retry the `ConnectRemote` call a few times with a short backoff before giving up. Each failed attempt is still printed with its attempt number, and a device that is genuinely unreachable fails with the same error on every attempt and then exits as before, so this does not mask a broken connection, it only adds a few seconds in that case. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
…r. (#215252) Update the order in which operands for SCEVAddExpr are expanded. Negative non-constant operands are moved to the end, matching the equivalent ordering in SCEVExpander's LoopCompare. Negated operands require multiplying with a negative constant, so it is better accumulated into the result than used to start it: a following operand can then be folded into the running sum, which removes a few adds. The impact in this patch is small (just a few improvements), but it is also a prerequisite for expanding those operands as a subtraction, matching IR SCEVExpander in more cases. PR: #215252
…#215588) In #210373 libc_assert.h added includes for io.h, exit.h and integer_to_string.h guarded by '#ifdef LIBC_FULL_BUILD' In the Bazel overlay which does not define LIBC_FULL_BUILD __support_libc_assert was updated to unconditionally depend on : __support_osutil_io, :__support_osutil_exit_hdrs and :__support_integer_to_string __support_osutil_io selects platform headers only for Linux, macOS and Windows Adding it to __support_libc_assert causes analysis failure when building for other / baremetal platforms that depend on libc_headers , __support_osutil_exit_hdrs is Linux only , __support_integer_to_string adds overhead Signed-off-by: Vladimir Suvorov <suvorovv@google.com>
The pre-RA Zilsd optimizer previously allowed a special case for stores where both source operands were the same vreg if that vreg was defined by COPY $x0. This assumes register allocation will preserve the value as x0, but that is not guaranteed. The vreg can be allocated to a normal GPR, producing an invalid pair.
The malloc_enable_child does not need to be a public API, instead move the function to be static and reference it that way.
The declaration was added on June 23, 2025 in commit d31ba52 without a corresponding function definition.
…215020) Add the expected<void, E> partial template specialization to support functions that return an error on failure and nothing on success, matching std::expected<void, E>. I've used this to resolve a TODO in if_nameindex and converted a few other simple internal functions (pwd_utils::open/close, update_from_seconds, stat_via_statx). Assisted by Gemini.
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 : )