[X86] Require legal result types for f32 estimates
The single-precision paths in `getRecipEstimate` and `getSqrtEstimate`
match a fixed set of scalar and vector f32 types, then check the
corresponding subtarget features. Those checks do not imply that the
result type is legal. Soft-float makes these result types illegal. Scalar
f32 is also illegal on a 32-bit SSE1 target without SSE2 or x87. The hooks
can then build an X86-specific estimate node with an illegal result type
before type legalization. Type legalization has no rule for that node, so
compilation fails.
Require a legal result type before entering the single-precision estimate
paths. The f16 paths in these hooks already require a legal type. After
this patch, the f32 paths match that behavior. The hooks return no estimate
for an illegal result type, so the original division or square root stays
in the DAG and follows its normal lowering. Estimate code generation for
legal result types is unchanged.
Fixes https://github.com/llvm/llvm-project/issues/217801
Assisted-by: Claude Opus 5, GPT-5.6 Sol.
[SLP]Fix insert point for struct-call extractvalue entries with multi-block scalars
Emit the vector extractvalue right after the vectorized call it depends
on, so it dominates all uses.
Fixes #223726
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/223766
[OpenMP][docs] Finish MyST migration for OpenMP docs (#222194)
This was prepared with rst2myst plus LLM-assisted cleanup. The main
manual intervention was porting CommandLineArgumentReference.(rst|md) to
the semantic [`option`
directive](https://www.sphinx-doc.org/en/master/usage/domains/standard.html#directive-option),
which causes some rendering differences.
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 #222191, which is a standalone commit that
renames *.rst -> *.md before this PR lands for history preservation
purposes.
Please spot check my work and approve if it looks good. You can use the
HTML links below to confirm it renders properly.
[179 lines not shown]
[OpenMP][docs] Rename reStructuredText files to Markdown (#222191)
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.
Validation:
- Confirmed this commit contains exactly 34 `.rst` to `.md` renames and
no content changes.
- The complete stacked migration is validated in the follow-up PR.
[bazel] Use new rules_cc API to determine musl targeting (#223549)
This avoids requiring hermetic-llvm in the public BUILD file API.
Downstream users need to update to this version of rules_cc
NAS-143783 / 26.0.0 / Test the client does not hang when it is given `job=True` for a non-job (by themylogin) (#19734)
Original PR: https://github.com/truenas/middleware/pull/19720
Co-authored-by: themylogin <themylogin at gmail.com>
[CMake] Factor check- target deps to reduce build.ninja size by 45%
Many LLVM developers are not aware, but our lit CMake logic creates a
check-* target for every eligible subdirectory inside a lit test suite.
There are thousands of these targets; in the benchmark configuration:
```
❯ ninja -C build -t targets all | grep '^check-' | wc -l
2667
```
Chris Bieneman originally added this feature in March 2015. The original
change suppressed these targets for Xcode and Visual Studio because the
target clutter hurt IDE usability; rL344555 later generalized that
behavior behind LLVM_ENABLE_IDE.
When using the Ninja generator, each of these check-${proj}-${subdir}
targets repeats its suite's transitive test dependencies, like so:
[52 lines not shown]
[CMake] Remove unused configuration probes
Several config-ix checks either have no consumer or can be performed directly
by the source that needs the feature. Remove six compiler invocations from a
typical Linux configure:
* HAVE_PTHREAD_MUTEX_LOCK has been unused since LLVM switched its mutex
implementation to std::recursive_mutex in 2019.
* The Linux magic-header results have never been propagated to config.h, so
CMake builds already use Path.inc's fallback constants.
* FE_ALL_EXCEPT and FE_INEXACT can be tested directly after including cfenv.
* The Valgrind and CrashReporter headers can be detected with __has_include in
their only consuming translation units.
Also remove the obsolete definitions from the GN and Bazel configurations.
In a fresh minimal LLVM configure, CMake profiling attributed 2067.1 ms to 45
config-ix probes before this change and 1846.9 ms to 39 probes after it.
[6 lines not shown]
[offload][omp] Move OpenMP KLE to libomptarget
Move preparations related to OpenMP KLE and
dynamicCGroupMem fallback out of the plugins and
into libomptarget.
Resructure Device::launch as it grew too large.
[DAG][X86] Do not narrow trunc(select) to a type undesirable for SELECT
DAGCombiner rewrites trunc(select c, a, b) as select c, (trunc a), (trunc b)
whenever truncating is free. On X86 that fires for i8, and where CMOV is
available there is no 8-bit form of it, so LowerSELECT widens the narrow select
back to i32 through ANY_EXTENDs, which lower to MOVZX. The narrowing then only
buys a byte ALU chain plus a MOVZX for each operand that became an i8 op:
orb $64, %al orl $64, %eax
movzbl %al, %eax cmovneq %rcx, %rax
cmovnel %ecx, %eax
Gate the fold on isTypeDesirableForOp(ISD::SELECT, VT) and let X86 report i8 as
undesirable when it can use CMOV. Without CMOV the select lowers to a branch
instead, where i8 operands are fine, so narrowing stays enabled there. The hook
defaults to isTypeLegal(VT), so guarded by isTypeLegal it is a no-op for every
target that does not override it. A select of two constants stays exempt: it
introduces no truncate of a computed value, so the narrow form is never worse.
Assisted-by: Claude Code
[X86][NFC] Pre-commit tests for trunc(select) narrowing
DAGCombiner narrows trunc(select c, a, b) to the truncated type. On X86 that
gives an i8 select, which is widened back to i32 wherever CMOV is available,
so the narrowing only adds a byte ALU chain and a MOVZX.
Assisted-by: Claude Code
[CIR] Support pointer-to-int global initializers (#220643)
This allows CIR to emit global initializers where a constant address is
cast to an integer.
This fixes compound literals like `unsigned long addr = (unsigned
long)(int[]){1, 2, 3}` and also handles global variable, array element
and function addresses cast to integers.
Fixes #216618
18405 Panic in smbios_open() when booted in VirtualBox
Reviewed by: Andy Fiddaman <illumos at fiddaman.net>
Reviewed by: Michael van der Westhuizen <r1mikey at gmail.com>
Approved by: Gordon Ross <gordon.w.ross at gmail.com>
RuntimeLibcallsEmitter: Let a consumer's own library variant beat its exclusion
A target can pull a shared library via LibraryRef<Lib, [impls]> to drop some
impls, then re-add its own versions through a same-name library variant guarded
on that target. Previously the exclusion's setUnavailable calls were emitted at
the end of setAvailableLibFuncs_<name>, after every variant, so they clobbered
the target's own re-adds.
Defer emitting a variant until after the exclusions when it re-adds an impl its
own consumer excludes (same predicates), so the target's re-add wins while
the exclusion still suppresses every other variant's contribution.
This is yet unused infrastructure for future changes.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
RuntimeLibcallsEmitter: Add isolated LibcallLibrary variant
This is essentially a hack to not break the common core functions shared
by most targets. Most targets have essentially the same base set of
compiler-rt or libc/libm functions, but a few are so radically different
there is nothing in common (e.g., the GPU targets have a handful of functions,
arm64ec changes every single function). This bit will pull these out of the
library merge-by-name system, and emitted as its own special case. This allows
the single name to be universal across targets without duplicating large
tables in the emitted inc file.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
RuntimeLibcallsEmitter: Handle calling conv in per-library functions
Pull handling of the default calling convention into the
setAvailableLibFuncs_<name> functions, so the library logic will be
fully contained.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[CIR] Support SubstNonTypeTemplateParmExpr for aggregates (#223603)
Lower `SubstNonTypeTemplateParmExpr` in `AggExprEmitter` by visiting its
replacement expression, matching classic Clang codegen (`CGExprAgg.cpp`)
and existing scalar (#146751), complex (#146755), and lvalue (#182920)
implementations.
The missing aggregate NTTP gap was analyzed with LLM assistance.
Fixes #223533
[lldb] Compare registers by LLDB register number (#223704)
Fix `GetIndexOfChildWithName`/`GetChildMemberWithName` on `Windows
x86_64` (Release builds), where comparing registers by RegisterInfo
pointer identity could spuriously fail to find sp/rsp in the GPR set.
Compare by `eRegisterKindLLDB` number instead.
Failing bot: https://ci-external.swift.org/job/lldb-windows/job/main
[mlir][sparse] Lower affine before SCF to CF in sparsifier (#219860)
Fix the lowering order in the sparsifier pipeline by running
`convert-scf-to-cf` after `lower-affine`.
Previously, `convert-scf-to-cf` ran while Affine control-flow operations
could still be present. For example, lowering an `scf.if` nested inside
an `affine.for` introduces multiple blocks into the loop body, violating
`affine.for`'s single-block region requirement and causing verification
to fail.
Running `lower-affine` first converts Affine control flow to SCF. The
subsequent `convert-scf-to-cf` pass can then lower both the existing SCF
operations and those introduced by Affine lowering to CFG-based control
flow.
Fixes #217895
[AggressiveInstCombine] Fix shared libraries build (#223756)
Broken by #223728 by depending upon a function in ProfileData. Add that
as a dependency to fix the build.
Merge tag 'sysctl-7.03-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl
Pull sysctl fixes from Joel Granados:
- Re-add the range check for millisecond to jiffy conversion in sysctl
They where removed in d174174c6776 ("sysctl: replace
SYSCTL_INT_CONV_CUSTOM macro with functions") and b96b5c6708ea
("sysctl: Replace do_proc_do{int,ulong,uint}vec with do_proc_vec")
- Fix type truncation in sysctl_msec_to_jiffies
Previously truncated millisecond values now get converted into
MAX_JIFFY_OFFSET
* tag 'sysctl-7.03-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl:
sysctl: Fix type truncation in sysctl_msec_to_jiffies
sysctl: Check range in do_proc_ulong_conv_ms_jiffies
sysctl: Check range in proc_dointvec_ms_jiffies_minmax
[lldb][Windows] Key lldb-server's loaded-module list by base address (#223445)
`NativeProcessWindows` keys `m_loaded_modules` by `FileSpec`, so a
second mapping of an already-loaded DLL overwrites the first one's base
address, and `OnUnloadDll` then erases by address. The wrong mapping
gets dropped.
This reproduces reliably in swiftlang where `swiftCore.dll` is loaded
twice.
This patch maps by base address instead (the identity `UNLOAD_DLL`
carries), so an unload resolves to the right file and only retires the
reported entry when it is that file's last mapping.
It introduces the `LoadedModuleList` class to key the modules correctly
and 9 regression unit tests.
---------
Co-authored-by: Nerixyz <nero.9 at hotmail.de>
RuntimeLibcalls: Update library-ref test for removed EABIVersion parameter
This test was added on main after the parent commit was written, so its
CHECK lines still expect EABIVersion in the generated dispatcher calls.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[DAGCombiner] Port custom DAG combine for `rem` from NVPTX (#210344)
Part of #116695
Supersedes #167147
Port NVPTX combine for `rem` to DAGCombine. Folds `Num % Den -> Num -
(Num / Den) * Den` if `DIVREM` is not supported by the backend.
[ConstraintElim] Unify no-wrap queries. (#223537)
Unify no-wrap queries in new isKnownNoWrap helper, which checks both
wrap flags on instructions and query-based reasoning in a single place.
Checks signed/unsigned wrap depending on a flag.
Update both decompose and tryToStrengthenFlags to use shared helper.
This improves results in a number of cases, because some rules were only
implemented for tryToStrengthenFlags and others in decompose:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1313
Note that there are 2-3 small regressions due added flags/removed
branches pessimizing other parts of the pipeline.
Compile-time impact in the noise for geomean. Notable individual changes
is mafft -0.05% in stage1-ReleaseThinLTO, and lencod +0.05% for
stage2-O3.
[2 lines not shown]
[Clang][Sema] Add Diagnostic for using matrix logical on non HLSL targets (#223252)
Make Clang emit an error message instead of crashing when using matrix
logical operations on non-HLSL targets.
Issue #222381