[flang][OpenMP] Make sure that exec METADIRECTIVE is in execution part (#233147)
A METADIRECTIVE can be in either the specification part or the execution
part, depending on whether the variant directives contained in it are
declarative or executable. The OmpMetadirectiveDirective AST node can
hold any combination of variants, that is it can represent both kinds.
When the parser builds the specification part and attempts to create an
OmpMetadirectiveDirective, once it gets one it puts it in the
specification part regardless of the contents.
When an executable METADIRECTIVE is the first statement of the execution
part, it will end up in the specification part. This is an identical
situation as that for utility directives.
Recognize executable METADIRECTIVEs at the end of the specification part
and move them over to the beginning of the execution part.
[libc] Implement seteuid and setegid in unistd (#233088)
Implement the standard POSIX functions `seteuid` and `setegid` in
`<unistd.h>`.
Fixes #232380.
Assisted by Antigravity and reviewed by Aman Maurya.
RuntimeLibcalls: Use a single LibcallImpl for long double functions
Replace the per-format <func>l_{f80|f128|ppcf128} implementations with
a single <func>l implementaton. The concrete type is now derived from
the module/triple's LongDoubleFormat, so this is no longer a static
property.
On targets where long double is double, the l-suffixed functions do
not provide a libcall. This could be fixed in principle, but nothing
would use it in the compiler.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AArch64] Support direct RCPC3 FP atomic loads and stores
Preserve half, bfloat, float, and double atomic loads and stores
through AtomicExpand for acquire and release orderings, and preserve
sequentially consistent stores, when RCPC3 and NEON are available.
Add SelectionDAG patterns for the RCPC3 LDAPUR and STLUR operations,
including unscaled offsets, and update the existing FP lane patterns to
match the preserved floating-point atomic nodes. Targets without the
required features continue to use integer lowering.
[NFC] Change strided loop name
Changes strided loop to be named grid-stride loop instead for less
ambiguity as stride describes the jump distance in general.
feat(gisel): mirror trunc/xor/select demanded bits
Mirror SelectionDAG demand propagation, traversal, known-bits folding,
truncation of logical shifts, and XOR narrowing and simplifications.
Respect shared producers, legality and target profitability. Preserve
integer LLTs when narrowing and recognize known-constant shift amounts.
Share shift-amount validation, XOR/shift profitability, and target XOR
constant searches between selectors without an instruction variant.
Enable demanded-bits combining for RISC-V and preserve legal constant
types after legalization. Cover target immediates and shared-mask
bypasses with MIR and code-generation regressions.
[AArch64] Support direct relaxed FP atomic loads and stores
This patch preserves half, bfloat, float, and double atomic loads and
stores through AtomicExpand when they use unordered or monotonic
ordering and the target supports floating point.
It adds SelectionDAG patterns that select the accesses directly in the
floating-point register bank. Unsupported targets, stronger orderings,
and stores carrying memory hints continue to use integer lowering.
RuntimeLibcalls: Emit signatures per libcall implementation
Index the signature table by RTLIB::LibcallImpl instead of
RTLIB::Libcall. RuntimeLibcallImpl inherits the signature of the
libcall it provides by default, but an implementation can now override
it. This will help avoid having multiple copies of the same libfunc
for every long double type.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[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] 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>
[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>
[DebugInfo] Visit static data member declarations in DebugInfoFinder.
types() skipped the class of a static data member when the class was
only reachable through the global variable's declaration.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Emit each debug scope from getOrCreateDebugScope.
Handlers return the opcode and the operands. getOrCreateDebugScope writes that instruction with a fresh id.
[SPIRV] Reject an extra DebugTypeFunction in the void prototype test.
CHECK-COUNT-2 still passes if a third prototype is emitted.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Use the default SmallVector size for DebugTypes.
The inline capacity was not measured, so leave it to SmallVector.
Co-authored-by: Cursor <cursoragent at cursor.com>