[clang] Make the _BitInt literal suffix a pedantic-only extension (#217815)
Clang diagnoses the `wb`/`uwb` `_BitInt` literal suffixes before C23
by default. Nothing else about the feature is reported that eagerly.
the `_BitInt` type the suffix names, is an `Extension` and only fires
under `-pedantic` or `-Wbit-int-extension`.
Change the suffix diagnostic to an `Extension` which is also how GCC
behaes.
Assisted-by: Claude Code
IR: Intersect and drop the addrspacecast nonnull flag (#217904)
Teach the flag-propagation controls about the nonnull flag
on addrspacecast.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[AArch64][PAC] Fix the list of registers clobbered by PAUTH_EPILOGUE (#220190)
When SP adjustment might be needed, whether X15 scratch register can be used
by PAUTH_EPILOGUE or not depends on PAuth LR hardening being requested for
the particular function, not the availability of `FEAT_PAuth_LR`.
[MLIR][ODS] Strip EnumAttr parameters in struct formats (#220727)
Add typed EnumAttr parameter wrappers for attribute and type
definitions.
Parse and print their underlying enum values inside struct directives.
Assisted-by: Codex
[MLIR][OpenMP] Preserve the debug location for the reduction barrier. (#220605)
`createReductionsAndCleanup` passed the insert point returned by
`createReductions` straight into `createBarrier`. That selects`
LocationDescription(const InsertPointTy &)`, which leaves the debug
location default-constructed, so the `__kmpc_barrier` and the
`__kmpc_global_thread_num` generated by `createBarrier` are emitted
without a !dbg.
That breaks the device link of a target region compiled with -g once a
device runtime built with debug info is present. The verifier fails with
the following error:
inlinable function call in a function with debug info must have a !dbg
location
%31 = call i32 @__kmpc_global_thread_num
inlinable function call in a function with debug info must have a !dbg
location
call void @__kmpc_barrier
[5 lines not shown]
[MLIR][Linalg] Clean up after removal of named ops
This patch removes all conversion patterns between category/generic and elementwise named ops, simplifying the morphisms.
[CIR] Migrate AssumeBundleKind, AtomicFetchKind and AsmFlavor off IntegerAttr
Continues the migration for the three enums reached through hand-written
parsers and printers rather than a plain argument reference.
cir.atomic.fetch references $binop from its declarative format, so that one
gains an `enum()` wrapper like the rest.
The other two need no code changes. printAssumeBundle and parseAssumeBundle
are already typed on cir::AssumeBundleKindAttr, and the wrapper keeps that
class name, so custom<AssumeBundle> still compiles and behaves the same.
InlineAsmOp::print streams getAsmFlavor(), which returns the enum and uses
the operator<< that -gen-enum-decls emits, not the attribute.
DefaultValuedAttr keeps taking the same C++ default expression for
$bundle_kind. Operation syntax is unchanged.
[CIR] Drop the redundant suffix from the inline kind mnemonic
This leaves no CIR enum attribute mnemonic repeating what its C++ enum class
name already says. inline_kind was the last one, and keeping it meant the
stack established a convention and then violated it in a file it was editing.
The attribute now spells `#cir.inline<always_inline>`. The operation argument
is still named inline_kind, since that is the accessor name and unrelated to
the mnemonic, so the printed form reads
`inline_kind = #cir.inline<always_inline>`.
While here, the enum's summary becomes "inline kind" instead of the camelCase
"inlineKind". That summary is what the generated dialect docs now show, since
CIR_InlineKindAttr no longer overrides it with a restatement of its own name.
25 CHECK lines change across four test files. Nine of them are in
CodeGen/AArch64/sme-inline-callees-streaming-attrs.c, which is
`REQUIRES: aarch64-registered-target` and so unsupported in an X86-only
build. The substitution there is identical to the one verified by
CIR/CodeGen/callsite-inline-attributes.cpp and CIR/IR/inline-attrs.cir.
[CIR] Migrate seven operation enums off IntegerAttr
CastKind, DynamicCastKind, CmpOpKind, ComplexRangeKind, InitCatchKind,
CaseOpKind and AwaitKind were I32EnumAttrs with the default
genSpecializedAttr, so each generated an IntegerAttr subclass. Operations
printed them symbolically because the format referenced the argument
directly, but the underlying attribute had no dialect spelling at all. In an
attribute dictionary or a generic-form dump it was a plain integer, so
`cir.cast bitcast` was stored as `kind = 1 : i32`.
Each enum now sets genSpecializedAttr = 0 and gets a CIR_EnumAttr wrapper,
which is the pattern EnumAttr.td documents, and the operations wrap the
argument in `enum()` to keep the bare keyword. The attributes gain a real
spelling, e.g. `#cir.cast<bitcast>`.
Operation syntax is unchanged, hence no test churn. enum-attrs.cir covers the
new standalone spellings, since nothing else in the test suite exercises
them. It also covers tls_model, whose spelling the earlier TLS commit
changed without leaving a standalone case behind.
[17 lines not shown]
[CIR] Drop lang_address_space's custom parenthesized attribute format
CIR_LangAddressSpaceAttr overrode its assembly format to
`(` custom<AddressSpaceValue>($value) `)`, so the standalone attribute
printed as `#cir<lang_address_space(offload_global)>`. The parentheses
defeated the dialect's `#cir.mnemonic<...>` syntax and forced the generic
fallback. It now uses the bracketed CIR_EnumAttr default and prints as
`#cir.lang_address_space<offload_global>`.
The override existed to make the enum read as `lang_address_space(x)` inside
`!cir.ptr` and `cir.global`. Those spellings are unaffected. Both go through
parse/printAddressSpaceValue on MemorySpaceAttrInterface in CIRTypes.cpp,
which prints the keyword and parentheses itself. The identically named
attribute-level pair in CIRAttrs.cpp was only reachable from the deleted
format, so it goes away.
[CIR] Print cir.global's TLS model without naked angle brackets
`cir.global` printed `tls_model = <tls_dyn>`. Those angle brackets were the
leftover delimiters of `#cir.tls_model<tls_dyn>` after the operation printer
stripped the dialect prefix and mnemonic. The same enum on the module printed
`cir.default_tls_model = #cir.tls_model<tls_dyn>`, so one enum had two
unrelated spellings and the per-global one was not something anyone would
write by hand.
Wrapping the argument in the `enum` directive prints the symbolic value on
its own:
cir.global external tls_model = tls_dyn @a = #cir.int<5> : !s32i
The standalone attribute is unchanged. invalid-tls.cir now sees a single
diagnostic from the operation's enum parser instead of two from the
attribute parser, and its input uses an invalid keyword rather than invalid
delimiters so it still exercises enum validation.
[CIR] Give the cleanup kind a proper standalone attribute spelling
CleanupKindAttr overrode its assembly format to a bare `$value` so that
`cir.cleanup.scope` would print `cleanup all` rather than `cleanup <all>`.
The price was that the attribute had no readable standalone form. It fell
back to the generic dialect-attribute syntax and printed as
`#cir<cleanup_kind all>`.
The `enum($attr)` operation format directive removes the tradeoff. The
attribute keeps the bracketed format CIR_EnumAttr gives it by default, and
`cir.cleanup.scope`, `cir.while` and `cir.for` ask for the bare symbolic
value instead, so the attribute now spells `#cir.cleanup<all>`.
The mnemonic drops the `_kind` suffix that the C++ enum class name carries.
`kind` says nothing a reader of `#cir.cleanup<all>` needs, and the rest of
this stack follows the same rule.
Operation syntax is unchanged. The negative test in invalid-loop-cleanup.cir
now sees a single diagnostic from the operation's enum parser, which also
lists the valid keywords, in place of the two the attribute parser emitted.
[CIR] Hoist genSpecializedAttr into the CIR enum base classes
Every one of the 33 CIR enum definitions set `genSpecializedAttr = 0`, and
none wanted the generated IntegerAttr subclass. That made the line pure
repetition, and worse, made "a CIR enum is never backed by IntegerAttr" a
convention each new enum had to remember rather than something the dialect
enforces.
Set it once on CIR_I32EnumAttr, CIR_I64EnumAttr and CIR_I32BitEnumAttr,
right next to the cppNamespace they already fix, and drop all 33 per-def
copies. Most of those defs carried nothing else, so they collapse from a
braced body to a plain `;`.
This is the same structure SPIRV_I32Enum, Tosa_I32Enum, GPU_I32Enum and
OpenMP's enum base class use. The `!if(genSpecializedAttr, ...)` expressions
in EnumAttrInfo resolve the same whether the bit is set on the def or
inherited.
The comment on CIR_SourceLanguage goes too. It explained the bit as being
[4 lines not shown]
[CIR] Delete the unused cir::VisibilityAttr
CIR_VisibilityAttr had no users. `cir.global` and `cir.func` carry visibility
as `DefaultValuedProp<EnumProp<CIR_VisibilityKind>>:$global_visibility`, a
property rather than an attribute, so nothing ever built or printed the
attribute and no test mentioned it.
Its only consumer was CIRGenModule::getGlobalVisibilityAttrFromDecl, itself
never called. That in turn was the only caller of
getGlobalVisibilityKindFromClangVisibility, so all three go away together.
The nearly identical getCIRVisibilityKind survives and does have a caller.
It maps clang::Visibility rather than clang::VisibilityAttr::VisibilityType,
so a future caller wiring visibility into the property has a starting point,
and git history has the rest.
CIR_VisibilityKind stays. It is the enum the property is built from.
Incidentally this removes one of the two attributes overriding their
assembly format to a bare `$value`.
[CIR] Derive lowering attr names from cppClassName, not the def name
CIRLoweringEmitter built its CXX_ABI_ALWAYS_LEGAL_ATTRS entries by calling
GetOpCppClassName on an attribute record, which splits the TableGen def name
at the first underscore. That works only while every def happens to be named
CIR_<CppClassName>Attr. When one is not, the emitter silently writes an
`isa<cir::Whatever>` for a class that does not exist, so the failure lands as
a compile error in generated code with no hint at the cause. The constraint
was real enough that CIREnumAttr.td had to document it.
Attributes already carry the authoritative name in cppClassName, and
GenerateAttrToValueVisitor two functions down was reading it correctly.
Factor that out as GetAttrCppClassRef and use it for the enum attributes and
the plain CIR attributes as well, which also drops the hardcoded `cir::` in
favour of the dialect's own cppNamespace. GetOpCppClassName stays for
operations, whose names are derived that way.
The def name is now free, so the paragraph in CIREnumAttr.td warning that it
is not goes away.
[4 lines not shown]
[CIR] Migrate MemOrder and SyncScopeKind off IntegerAttr
Same change as the previous commit, for the two enums the atomic operations
share. Both enums set genSpecializedAttr = 0 and gain CIR_EnumAttr wrappers,
and cir.load, cir.store, cir.atomic.fetch, cir.atomic.xchg,
cir.atomic.cmp_xchg, cir.atomic.test_and_set, cir.atomic.clear and
cir.atomic.fence wrap the arguments in `enum()`.
The `Arg<>`-wrapped declarations carrying operand documentation move to the
wrapper too, keeping their descriptions.
`enum()` accepts an optional-group anchor, so the `syncscope` and `atomic`
groups on cir.load and cir.store are unaffected. Operation syntax is
unchanged and no test needed updating.
[CIR] Migrate the FPClassTest bit enum and unquote its flags
cir.is_fp_class printed its flags inconsistently. One of the ten single-bit
values came out bare, as in `fcSNan`, while every group value and every
multi-flag combination came out quoted, as in `"fcInf"` and
`"fcSNan|fcNegInf"`. That split comes from I32BitEnumAttr setting
printBitEnumQuoted, which EnumAttr.td marks as kept only for backwards
compatibility. The bit makes the printer quote anything that is not a single
bit.
Clearing printBitEnumQuoted and using the `enum` directive selects the
separator-aware parser and printer, so every value now spells unquoted:
cir.is_fp_class %x, fcInf : (!cir.float) -> !cir.bool
cir.is_fp_class %x, fcSNan|fcNegInf : (!cir.float) -> !cir.bool
The enum also drops its specialized IntegerAttr in favour of a CIR_EnumAttr
wrapper, like the rest of the stack, giving it a standalone spelling of
`#cir.fp_class<fcSNan|fcNegInf>`. The wrapper is named CIR_FPClassTestAttr
[5 lines not shown]
[CIR] Migrate GlobalLinkageKind, CallingConv and SideEffect off IntegerAttr
The last of the I32EnumAttr-backed operation enums, apart from the bit enum
handled next. Each sets genSpecializedAttr = 0 and gains a CIR_EnumAttr
wrapper, and cir.global wraps $linkage in `enum()`.
cir.func and cir.call print all three through hand-written code, but they
stream stringifyGlobalLinkageKind(getLinkage()) and friends. Those take the
enum rather than the attribute, so the sites are unchanged. The
DefaultValuedAttr defaults for $linkage, $calling_conv and $side_effect keep
taking the same C++ expressions.
Operation syntax is unchanged, so no test needed updating.
GlobalLinkageKind's wrapper is spelled `#cir.linkage<internal>`, dropping
both the `global_` prefix and the `_kind` suffix that the enum class name
carries for C++ reasons.
[CIR] Record why the CUDA registration attribute parses itself
hasCustomAssemblyFormat with no explanation invites the question of whether a
declarative assemblyFormat would do, and the answer is not obvious from the
parameter list. It would not. The three flags print as presence-only keywords
and parse in any order, while an optional group anchored on a `bool`
parameter parses and prints a value, so the group would spell `extern true`.
MLIR has no presence-only flag for `bool` in an attribute format, unlike
UnitAttr in an operation format. struct(params) does round-trip, but spells
the attribute `<device_side_name = "i", kind = Variable, isExtern = true>`
instead of `<i, Variable, extern>`.
NFC.
[CIR] Drop dead ceremony around the CIR enum attributes
Five things that no longer earn their place, all in the enum attribute
machinery this stack has been reworking.
CIR_CleanupKindAttr carried three of them. Its cppClassName was a no-op.
CIR_EnumAttr derives from AttrDef<dialect, enumInfo.className>, and AttrDef
already defaults cppClassName to name # "Attr", which is exactly
CleanupKindAttr. Its skipDefaultBuilders plus hand-written AttrBuilder
existed only to default $value to CleanupKind::All. All three callers
(cir.while, cir.for and parseCleanupKind) pass an explicit kind, so the
default was unreachable while the generated builders stayed suppressed for
nothing. And its summary and description restated the name, overriding the
enum's own "cleanup kind" with a longer synonym. EnumAttr inherits both, so
deleting the overrides improves the generated dialect docs. Only the
isNormal / isEH / isNormalAndEH helpers were doing any work, and they stay.
CIR_TLSModelAttr's summary restated the name the same way. Its description
is informative, so only the summary goes.
[4 lines not shown]
IR: Add nonnull flag to addrspacecast (#217903)
Introduce the nonnull flag on the addrspacecast instruction,
asserting that the source pointer is not the null value of its
source address space. If the source is the source-address-space null
value, the result is poison.
The LangRef does not yet acknowdlege the existence of non-0 null
pointers, or null pointers for address spaces other than default,
but will "soon".
This gives the target a way to omit the runtime null check to map
between the null values. Currently AMDGPU works around the lack of
this flag by introducing the hacky llvm.amdgcn.addrspacecast.nonnull
intrinsic in a late target codegen pass.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[MLIR][Linalg] Clean up after removal of named ops
This patch removes all conversion patterns between category/generic and elementwise named ops, simplifying the morphisms.
[orc-rt] Group lib/bedrock per-OS sources under sys/. NFC. (#220851)
include/orc-rt-internal/support/ already nests its per-OS headers under
sys/ (e.g. support/sys/darwin/CacheControl.h). lib/bedrock/ had darwin/,
linux/, posix/, and windows/ as bare siblings of the generic .cpp files
and sps/, so the two trees didn't line up.
Move them under lib/bedrock/sys/ to match, and update the source lists
and comments in CMakeLists.txt accordingly.
[MLIR][Linalg] Remove linalg.select op
Removes the named op `select` from the Linalg dialect. This is an
initial PR following the RFC in the forum:
https://discourse.llvm.org/t/rfc-update-semantics-of-linalg-named-operations-unary-binary-ternary/91531
I have also update the ElementwiseOp builder to simplify the default
case: kind + no affine map.
As a first approach, these are the things we'll need to do to all ops:
1. Remove from OpDSL (yaml / python)
2. Remove from morphism transforms (-to-named & named-to-)
3. Replace all uses of linalg::XOp::create with
linalg::ElementwiseOp::create
4. Update affected transforms to match elementwise instead of named ops
5. Update affected tests
[MLIR][OpenMP] DeclareTargetInterface and DeclareTargetAttr cleanup
The changes introduced by this patch are intended to avoid triggering
multiple by name lookups to the "omp.declare_target" attribute every
time any data from the `DeclareTargetInterface` is queried, remove the
need for keeping multiple default values for the same data, clean up
the assembly format and generally improve the usage of the interface.
List of changes:
- `DeclareTargetInterface` only provides `setDeclareTarget` and
`getDeclareTarget` methods to handle the "omp.declare_target"
attribute, maintaining a single canonical way of accessing it.
- `DeclareTargetAttr` provides direct access to the capture clause and
device type enums, rather than wrapping them into an `Attribute`.
These are now mandatory as well. Both changes together make accessing
them more straightforward and simplify the attribute representation.