[CMake] Pass through -DCMAKE_MAKE_PROGRAM= when generating profdata for clang (#225970)
Since we're already passing the -DCMAKE_GENERATOR through, we need the
corresponding CMAKE_MAKE_PROGRAM, which CMake doesn't always know how to
find itself.
rdar://187916126
[AMDGPU] Clear NoPHIs after SIFixSGPRCopies under the new pass manager (#238429)
SIFixSGPRCopies can build waterfall loops, which add PHIs. The legacy
pass declares that it clears NoPHIs, but the new pass manager's
SIFixSGPRCopiesPass declared no properties and never applied them. So a
function kept NoPHIs after the pass added a PHI, and the machine
verifier rejected it. Declare the cleared property and apply it with
MFPropsModifier. The test waterfalls a buffer load's resource under both
pass managers.
[AMDGPU] Use the mul24 result width for known bits
Extend the low 24 operand bits to the destination width before multiplying. Using the i32 operand width for i64 results can incorrectly fold upper product bits to zero.
Cover signed and unsigned i64 results and restore the bf16-to-i128 sign-extension checks affected by the incorrect inference.
[AMDGPU] Track GlobalISel known bits for mul24 intrinsics
Sign or zero extend the low 24 operand bits before querying KnownBits::mul. This allows GlobalISel to narrow shifts and simplify address calculations through mul24 intrinsics.
Cover ignored high bits, zero operands and overflow, and update the affected codegen checks.
[KnownBits] Cover negative multiplication boundaries
Exercise both operand orders and i8, i32, i65 and i128 results. Preserve cases where zero or signed and unsigned wraparound prevent leading-bit inference.
TableGen: Keep the instregex prefix for patterns with a top-level ?
instregex discarded a pattern's literal prefix, and ran the regex on
every instruction, if the pattern had a ? outside parentheses, as in
LDPS?Wi. A ? only makes the atom before it optional, and an atom
directly before it is already dropped from the prefix. Only a top-level
| makes the prefix unusable.
AArch64GenSubtargetInfo.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 44.6 18.8 5.7
After 43.1 (-3.4%) 17.8 (-4.9%) 5.4 (-4.6%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR][NFCI] Prepare LLVM lowering patterns for one-shot conversion (#235196)
One-shot conversion (which speeds up LLVM lowering significantly) erases
the root op as soon as a pattern replaces it, so any read of the op past
that point is a use after free. Capture the values the lowering patterns
reuse after the replace: the parent location and module in the
CIRAttrToValue visitors and the MemSet alignment. AtomicXchg is split
into create plus replace so the forward helpers still see a live op.
Region type conversion also moves ahead of the block moves in the FuncOp
and generic patterns, so a conversion failure leaves the body unmoved
for the driver to report.
[BoundsSafety][Docs] Track upstream status in a GitHub issue
Replace the BoundsSafetyUpstreamStatus page with a short summary in the
Upstream Status section of the index page, and link to a tracking issue
for the details. The per-feature tables and PR links change often, and
are easier to keep up to date in an issue than in the docs.
Assisted-by: Sonnet 5.5
[BPF] Sign-extend constants folded from sign-extending loads (#238316)
`PreprocessLoad` replaces a load from a constant global with the
constant value, but always zero-extends it. On v4, where LDSX is legal,
the load can be a `SEXTLOAD`, and the sign extension is lost:
```
struct S { signed char a; };
static const struct S g = { -1 };
long f(void) { return *(&g.a); }
```
clang --target=bpf -mcpu=v4 -O0: r0 = 255 ; should be -1
At -O1 and above the load is folded in IR first, and clang folds a plain
`g.a` itself, hence `-O0` and `*(&g.a)`.
Sign-extend the folded constant when the load is a `SEXTLOAD`.
[CIR][EH] Drop personality from functions without landing pads (#236322)
Match classic codegen, which sets a personality only where it emits
landing pad and erase the personality declaration once it is unused
RuntimeLibcalls: Use size_t for the align_val_t arguments of new and delete (#238237)
std::align_val_t has size_t as its underlying type. Some overloads
used IntPlus, which is too narrow on 64-bit targets. No test changes
because no target adds these to the libcall sets yet.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86] Fix crash when calling through __ptr32 function pointer (#209078)
Fixes #56199
Calling through a __ptr32 function pointer on x86-64 crashes during
instruction selection
because LowerCall doesn't extend the 32-bit callee to 64-bit.
This patch sign-extends __sptr (addrspace 270) and zero-extends __uptr
(addrspace 271)
callee pointers to i64 before building the CALL/TC_RETURN node.
CodeGen: Replace TargetOptions::DebuggerTuning with module flag
Read the debugger tuning from the module's "debugger-tuning" flag instead of
TargetOptions. Delete the now-dead -debugger-tune= cl::opt and the
TargetOptions::DebuggerTuning field.
Update the tests relying on it to directly use the module flag. The cases
that exercise multiple values do a text substitution to swap the value.
Alternatively this could be changed to synthesize the module flag in the
llc flag like some of the other widely used module flags do.
Co-authored-by: Claude Sonnet 5 <noreply at anthropic.com>
[flang][OpenMP] Improve diagnosing invalid operators in DECLARE_REDUCTION (#232353)
Move the check out of the common MakeNameFromOperator function and
into OmpStructureChecker. Remove the no longer needed SemanticsContext
parameter in MakeNameFromOperator.
This will allow reusing at least some parts of the the name-mangling
code in DECLARE_INDUCTION.
[LLDB] Guard Process::m_instrumentation_runtimes with a mutex
This patch is the sixth part in a patch series that will allow
enabling/disabling InstrumentationRuntime plugins in a running debug
session.
`Process::m_instrumentation_runtimes` can be accessed from multiple
threads. For example, a plugin can be enabled/disabled in a process
from the command thread (or from another debugger when using the
`global` domain) while `Process::ModulesDidLoad()` iterates over the
plugins on another thread, or while an SB API client calls
`Process::GetInstrumentationRuntime()`. These accesses were
unsynchronized.
Now every access to `m_instrumentation_runtimes` is guarded by the new
`m_instrumentation_runtimes_mutex`:
* `Process::Finalize()` and `Process::DidExec()` clear the map while
holding the mutex.
[13 lines not shown]
[LLDB] Keep InstrumentationRuntime plugins alive during breakpoint callbacks
This patch is the fifth part in a patch series that will allow
enabling/disabling InstrumentationRuntime plugins in a running debug
session.
InstrumentationRuntime plugins passed a raw `this` pointer as the baton
for their breakpoint callbacks. Now that disabling a plugin in a process
destroys the plugin instance, a plugin could be destroyed (e.g. by
`plugin disable` running on the command thread) while one of its
breakpoint callbacks was running on another thread (e.g. the thread
handling the stop event), causing a use-after-free.
Try to partially fix this by keeping a plugin alive while the baton is being
used. Now the plugins use a baton created by
`InstrumentationRuntime::CreateBreakpointBaton()` which only holds a weak
reference to the plugin. In a callback,
`InstrumentationRuntime::GetRuntimeFromBaton()` gets a strong reference to the
plugin which keeps the plugin alive until the callback finishes. If the plugin
[13 lines not shown]
[libc++] Implement LWG3601: `common_iterator`'s postfix-proxy needs `indirectly_readable` (#237574)
`common_iterator::operator++(int)` now returns the postfix-proxy only
when the underlying iterator is `indirectly_readable`. Previously, a
non-readable iterator with a usable `value_type` and a non-referenceable
`*it++` got a proxy holding a copied value. Now it gets the result of
the underlying `it++`.
Fixes #104946
[LLDB] Support enabling/disabling InstrumentationRuntime plugins in a debug session
This patch is the fourth part in a patch series that will allow
enabling/disabling InstrumentationRuntime plugins in a running debug
session.
This is a rework of an older now abandoned patch:
https://github.com/llvm/llvm-project/pull/193334
Previously enabling/disabling an instrumentation runtime plugin via the
`plugin enable/disable instrumentation-runtime.<name>` command was only
supported using the `global` domain. This only toggled the plugin's
enablement state in the PluginManager. This would affect the enablement
in newly launched processes but not in any existing processes. In
practice what this meant is that:
1. If the plugin was activated when the inferior process was launched it
could not be disabled even if requested. This meant it was impossible
to prevent LLDB from stopping at the breakpoint set by an
[106 lines not shown]
TableGen: Describe intrinsic attributes with IR Attributes definitions (#237605)
Once upon a time attributes were not declared in tablegen. The backend
tablegen components grew a separate IntrinsicProperty system parallel
to the IR attributes and the emitter maintained a not-quite 1:1
mapping system between them. This is a step towards unifying the
attributes and intrinsic properties.
Intrinsic properties that correspond directly to an IR attribute now
name the Attributes.td record they imply. CodeGenIntrinsic collects
the records generically instead of decoding each property into a
dedicated bool or ArgAttrKind enum value, and the emitter prints the
attribute name from the record rather than maintaining a manual
property to attribute mapping.
Properties with special behaviors (memory effects, Throws,
IntrHasSideEffects, Commutative, IntrTriviallyScalarizable) are still
handled individually. Throws should really be replaced especially
given we have a list of default intrinsic attributes that could add
[2 lines not shown]