[clang][BPF] Do not emit preserve_static_offset markers for field info (#234280)
__builtin_preserve_field_info on a field of a preserve_static_offset
record crashes clang in BPFAbstractMemberAccess, for example
bpf_core_field_exists(skb->mark) with a marked struct __sk_buff.
Every release since 18 is affected.
BPFAbstractMemberAccess computes the field relocation from the
preserve.*.access.index calls that CodeGen emits for the builtin's
argument. CodeGen also wraps each access to a marked record in
llvm.preserve.static.offset, and BPFPreserveStaticOffset replaces the
access-index calls under such markers with plain GEPs, so that loads and
stores keep static offsets. The field-info call is left without type
metadata, and BPFAbstractMemberAccess dereferences a nullptr.
Field info never dereferences the field, so the markers serve no purpose
there. Do not emit them while emitting the builtin's argument.
[9 lines not shown]
Attributor: Add only new attributes when manifesting
manifestAttrs collected the attributes to add in an AttrBuilder, then
copied the position's attribute set into another AttrBuilder to merge
them in. Collect them in an array and merge them into the set in one
pass. This requires the attributes passed to manifestAttrs to be sorted
like an attribute set, which all callers already do. The only one
passing more than one attribute is AMDGPUAttributor, whose implicit
argument attributes are sorted.
Instructions spent in amdgpu-attributor:
rocPRIM test_device_scan, gfx942: 770.2M -> 710.8M (-7.7%)
Blender Cycles HIP kernel, gfx1100: 380.0M -> 379.5M (-0.1%)
rocPRIM 16 tests, full LTO, closed world: 3019.8M -> 2855.9M (-5.4%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang-tidy] Fix `performance-noexcept-move-constructor` for implicit `noexcept(false)` (#226488)
The `performance-noexcept-move-constructor` check incorrectly handles
move constructors and move assignment operators whose exception
specification is implicitly `noexcept(false)`.
To avoid this, I added a check for a valid source range corresponding to
the `noexcept specifier`.
Closes https://github.com/llvm/llvm-project/issues/195637
---------
Co-authored-by: EugeneZelenko <eugene.zelenko at gmail.com>
[X86] Fold (sext_in_reg (logic x, y)) -> (logic x, (sext_in_reg y)) (#234611)
If either vector operand is already sign-extended, then try to push the
sext_in_reg further up the DAG.
I've also renamed the ExtVT to match DAGCombiner::visitSIGN_EXTEND_INREG
(and because ExtraVT made no sense....).
Fixes #233272
[SPIRV] Drop --verify-machineinstrs from new lexical-block RUN lines.
The machine verifier already runs on the buildbots.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Emit DebugLexicalBlockDiscriminator for a DILexicalBlockFile.
A location scoped at a DILexicalBlockFile was emitted as a DebugScope of the compilation unit, so the discriminator did not round-trip.
Use the discriminator as the DebugScope operand, matching SPIRV-LLVM-Translator.
[SPIRV] Expect no unlisted DebugTypeMember in the self-pointer forward-refs test.
Without forward references, member next is no longer emitted after S and
its pointer, since S cannot list it.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Drop --verify-machineinstrs from new forward-ref tests.
The machine verifier already runs on the buildbots.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Forward-reference debug scopes with a reserved result id.
Visiting a scope reserves its result id. With SPV_KHR_relaxed_extended_instruction a back edge uses that id through OpExtInstWithForwardRefsKHR, and a later failure defines it as DebugInfoNone when an emitted instruction already named it.
Without the extension the edge is dropped and a later walk can retry the scope.
[SPIRV] Emit each debug scope from getOrCreateDebugScope.
Handlers return the opcode and the operands. getOrCreateDebugScope writes that instruction with a fresh id.
[SPIRV] Emit DebugTypeMember only from its DebugTypeComposite.
DebugTypeMember has no Parent operand, so the composite is the only
instruction that lists it. Emitting a member from the type walk, or
from a static member declaration, after its composite left a
DebugTypeMember that the composite did not list.
Drop members from the type walk and only look up the static member
declaration of a global variable.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Simplify the module-scope debug scope walk.
getOrCreateDebugScope emits each scope after its dependencies, so the
walk does not need a fixed order between scope kinds. Walk lexical
blocks, types and subprograms in a single loop, and keep subprogram
declarations and definitions in one container.
Co-authored-by: Cursor <cursoragent at cursor.com>
[AArch64] Fold MUL + shifted-register ADD into MADD (#231356)
Add MachineCombiner patterns that fold a MUL and a following
shifted-register ADD into a MADD. The shift becomes a separate
bitfield-move instruction.
For example, with
```
int f(int a, int b, int c) {
return a*b + (c>>2);
}
```
LLVM currently generates:
```
f:
mul w8, w1, w0
add w0, w8, w2, asr #2
ret
```
[10 lines not shown]
[clang] Fix constexpr __builtin_convertvector float-to-bool conversion (#230690)
This fixes the conversion from float to bool in
`__builtin_convertvector`.
The fix is simply adding the missing case to `HandleFloatToIntCast`,
that mirrors the behavior of `HandleIntToIntCast`.
Fixes #228649
[flang][OpenMP] Fix verification of REF modifier on LINEAR clause (#232367)
The OpenMP spec has a bug: the restriction should read
> If linear-modifier is ref, list items must not be polymorphic variables,
> assumed-shape arrays, or variables with the ALLOCATABLE attribute.
---------
Co-authored-by: Markus Mützel <markus.muetzel at gmx.de>
(cherry picked from commit 53d096bbf31d12fddbbe2508b7f80bab9628430d)
tcp: fix incorrect assertion
tcp_autosndbuf() asserts that the buffer is locked, but it should assert
this about the send buffer, not the receive buffer.
Fixes: 7146ad04f18e ("tcp: refactor tcp_autosndbuf() and associated sysctls")
Reviewed by: tuexen
Sponsored by: Rubicon Communications, LLC ("Netgate")
[libc++] Share the benchmark paths and the LNT runs listing between the LNT tools (#234616)
This is a NFC commit that will simplify the introduction of refinement
tooling in upcoming PRs.
Assisted by Claude
[MLIR][LLVMIR] Add 'align' to loop-annotations (#234263)
This is necessary for the llvm.loop.align flag, which clang needs to
generate. Its a touch weird in that LLVM's verifier (not the MLIR
dialect!) enforces this as a 32 bit value, so we did have to do a
little work to make sure we enforce that too/sooner in the dialect.
[libc++][NFC] Update the LNT README to use GET /series (#234619)
I introduced a GET /series endpoint that is not paginated to simplify
tools that perform regression detection. Use that in the README example.
[libc++] Clean up leftover std::print availability workarounds (#234379)
The availability markup for std::print was removed in 4a87db6b10a0 and
the corresponding macros were deleted entirely in 1616fbaccf82. However,
several functions in <print> were left templates to work around
https://llvm.org/PR61563, which is not necessary anymore.
Remove a few workarounds that are now unnecessary, and reword others
that are required due to format now, not print.