SelectionDAG: Get libcall info from analysis, not TargetLowering
TargetLowering's copy of the libcall info will eventually be
removed. Use the LibcallLoweringInfo analysis from SelectionDAG
instead.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SLP][REVEC]Use scalar lane type for buildvector lists
The REVEC lane type of an insertelement is its vector type, so the
"no actual vectorization" check skipped every VF and the buildvector
of loads was never vectorized.
Fixes #239546
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/239825
[clang][ms] Add support for optional function argument in #pragma init_seg (#203769)
This PR adds support for function argument in #pragma init_seg as
defined by the Microsoft docs[1]
Closes #148938
[1] https://learn.microsoft.com/en-us/cpp/preprocessor/init-seg
---------
Co-authored-by: Tymofii Shchetilin <tymofii.shchetilin at gmail.com>
Co-authored-by: Reid Kleckner <rkleckner at nvidia.com>
test: Use -disable-output instead of -o /dev/null for IR tools
opt, llvm-as and llvm-dis can skip writing their output with
-disable-output rather than writing to /dev/null. Convert by script,
dropping -o /dev/null where -disable-output was already used. Skip a
few other special cases significant to the output, and XFAILed tests.
This appears to be very slightly faster (at best up to 1%).
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
BPF, Lanai, ARC, M68k: Register null target streamer
Since 44a08dc732c5, llc -filetype=null is a fatal error on targets
that do not register a null target streamer. These targets do not need
a target specific streamer for the null case, so register the base
MCTargetStreamer.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[MemProf] Test cloning of a trimmed cold callsite next to a sibling callsite with a cloned caller (#239790)
Adds a test for a shape seen in realworld: a caller with two callsites
into the same allocation wrapper, where one callsite is cold on every
path and its context is trimmed at an interior frame, while the sibling
callsite is cold on only one path (so the caller itself is cloned), and
the frame the trimmed context ends at is a real function on one path and
inlined into the caller's caller on the other.
The trimmed context sits on its own callsite node, so it is cloned cold
in every copy of the caller regardless of the inlining above it. A
second RUN drops the callsite metadata of the trimmed callsite, as a
profile that lost the out-of-line callsite record for that call would,
and checks the resulting loss: the call keeps the original callee in
every copy of the caller and the allocation stays ambiguous.
[NVPTX] Declare command line options in TableGen (#238141)
Move NVPTX's cl::opt and cl::list options into NVPTXOptions.td.
NVPTXSubtarget.h declares the generated options struct, and
LLVMInitializeNVPTXTarget registers its parser. Consumers access options
through target/subtarget getCLOpts() or LLVMContext.
Preserve getNumOccurrences()-based override semantics using
std::optional fields and BoolOrDefault for booleans.
Migrate nvvm-reflect-add to ListField, which supports repeated
occurrences and splits comma-separated entries.
Aided by GPT 6.
[ConstraintElim] Split signed min/max across their operands when checking a compare
The existing constraint systems only record the bounds that hold for both
operands of a min/max (smax(a, b) >= a and >= b, smin(a, b) <= a and <= b). The
other direction is a disjunction, which cannot be recorded as a fact. When a
compare of signed decompositions involves a min/max result, split it into its
operands: the decomposition is monotonic in that result, so it is the max or min
of its values on each side, and the relation holds for all or for either side
respectively.
https://alive2.llvm.org/ce/z/zsGkJ-
[ConstraintElim] Prove sadd/ssub.with.overflow cannot overflow from the exact sum
Decompose the operands and show that the sum lies in the range of the type. This
handles patterns like A + (B - A), as well as sums involving signed min/max
results, which are split across their respective operands using monotonicity
(for example start + smax(end - start - 1, 0) <= end).
https://alive2.llvm.org/ce/z/ze8LCk
AMDGPU: Remove clearKillFlags calls (#239806)
Kill flags on physical registers here are either never set by the
time this code runs or are on reserved or constant registers where
they carry no information. Remove the clearKillFlags calls.
SIPeepholeSDWA was adding a kill flag on the virtual register it ties
to the preserved destination and relying on the clear to remove it.
Stop adding it.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
MachineSink: Remove clearKillFlags calls (#239805)
Kill flags on physical registers here are either never set by the
time this code runs or are on reserved or constant registers where
they carry no information. Remove the clearKillFlags calls.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][openacc] report variables using global memory storage (#239814)
`ACCCGToGPU` right now only reports thread local memory and shared
memory storage it picks for a private variable, but says nothing when it
falls back to use global memory.
This change collects these variable names that are placed in global
memory and emits them under the remark `GPU global memory used for ...`
Variable names are collected from the discardable attribute
`acc.var_name` from the `acc.privatize` op, and skipped when the
attribute can't be found.
[lldb-server] Notify the accelerator plugins when the native process exits. (#237424)
Notify the accelerator plugins when the native process exits.
Added the testing using the MockAccelerator Plugin.
MC: Handle XCOFF directives in the null streamer
MCNullStreamer only overrode emitXCOFFSymbolLinkageWithVisibility, so
llc -filetype=null on AIX hit the llvm_unreachable in the MCStreamer
base implementations of .lcomm, .ref, .except and .info emission.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[cmake] Use MultiThreaded MSVC runtime library for Windows runtimes in Fuchsia caches (#238240)
Configure Windows runtimes with CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
to match the rest of the toolchain build.
X86: Remove clearKillFlags calls on virtual registers (#239802)
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[lldb] Fix a crash evaluating expressions at a scripted frame without variables (#239795)
`ScriptedFrame.get_variables()` returns `None` by default, which left
`ScriptedFrame::GetInScopeVariableList()` returning a null list.
`ClangExpressionSourceCode::AddLocalVariableDecls()` dereferenced that
list, so any expression evaluated at such a frame crashed LLDB.
This patch makes `ScriptedFrame` return an empty list when its interface
has no variables. Since `GetInScopeVariableList()` is virtual and other
subclasses could still return null, it also makes
`AddLocalVariableDecls()` handle a null list.
rdar://187386314
Assisted-by: Claude
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[ConstraintElim] Split signed min/max across their operands when checking a compare
The existing constraint systems only record the bounds that hold for both
operands of a min/max (smax(a, b) >= a and >= b, smin(a, b) <= a and <= b). The
other direction is a disjunction, which cannot be recorded as a fact. When a
compare of signed decompositions involves a min/max result, split it into its
operands: the decomposition is monotonic in that result, so it is the max or min
of its values on each side, and the relation holds for all or for either side
respectively.
https://alive2.llvm.org/ce/z/zsGkJ-
[ConstraintElim] A signed sum of operands with opposite signs cannot wrap
If one operand is known non-negative and the other non-positive, the signed
sum is between them, so it cannot overflow.
https://alive2.llvm.org/ce/z/ZF5Yqr
[ConstraintElim] Prove sadd/ssub.with.overflow cannot overflow from the exact sum
Decompose the operands and show that the sum lies in the range of the type. This
handles patterns like A + (B - A), as well as sums involving signed min/max
results, which are split across their respective operands using monotonicity
(for example start + smax(end - start - 1, 0) <= end).
https://alive2.llvm.org/ce/z/ze8LCk
[ConstraintElim] A signed sum of operands with opposite signs cannot wrap
If one operand is known non-negative and the other non-positive, the signed
sum is between them, so it cannot overflow.
https://alive2.llvm.org/ce/z/ZF5Yqr
[HLSL] Add macro for float->bool double overloads (#233024)
New macro captures the pattern for isfinite(), isinf(), and isnan().
Expected warnings now include template arguments, consistent with other
intrinsics' double overload deprecation warnings.
Assisted-by: Claude Sonnet 4
RISCV: Remove clearKillFlags calls on virtual registers (#239786)
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add signatures for the Darwin sincos stret functions
__sincos_stret and __sincosf_stret return a struct holding the 2
results. Describe the C struct return type in the signature table and
lower for the target ABI. This is a vector on x86-64 for float,
through memory on x86-32 and APCS ARM, and as a struct elsewhere.
This replaces the special case that built the types in C++. Ideally we
would be using the ABI library, but it's incomplete for most targets
and it requires some relayering to use here.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Describe the stack guard and safestack variables (#239422)
The stack guard and the unsafe stack pointer are global variables, not
functions. Describe them as variables in the signature table, with the
unsafe stack pointer thread local in the alloca address space, and
declare them as globals.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Revert "[MLGO] Do not evict live ranges with the same cascade number … (#239799)
…(#230468)"
This reverts commit 612fdc5a383cbdf97ce9e6e8f4177f54ead6f18a.
With
https://github.com/google/ml-compiler-opt/releases/tag/regalloc-evict-v1.1,
this patch causes us to run out of registers on x86 when compiling
certain functions:
```bash
clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O3 -disable-llvm-passes -mllvm -regalloc-enable-advisor=release -o /dev/null %s
```
```llvm
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
[74 lines not shown]
[lldb] Add accelerator dynamic loader over gdb-remote (#217393)
## Summary
This is the second change adding dynamic-loader support for
accelerators; the protocol foundation landed in #214564. It uses the
client-side `jLLDBSettings` support from #229179, depends on the
server-side support in #237356, and uses the CPU/accelerator
target-group relationship from #229180 and #232906.
- add a generic accelerator dynamic loader using `ProcessGDBRemote`
- let an accelerator GDB server select the LLDB dynamic-loader plugin
through `dyld_plugin_name`
- route `jAcceleratorPluginGetDynamicLoaderLibraryInfo` over either the
accelerator connection or the native connection, as selected by the
server
- identify the server-side accelerator plugin with
`accelerator_plugin_name` when forwarding over the native connection
- load modules from files, offload bundles, or images held in
[19 lines not shown]