adams381 wrote:
The parallel-array machinery is over-fitted for a multi-bundle world CIR
doesn't actually use. Every Clang builtin that lowers to `llvm.assume` with
bundles emits exactly one (`align`, `separate_storage`, `dereferenceable`), so
I'd propose a single-bundle shape with a kind enum:
```tablegen
def CIR_AssumeBundleKindAttr : I32EnumAttr<"AssumeBundleKind",
"kind of cir.assume operand bundle", [
I32EnumAttrCase<"None", 0>,
I32EnumAttrCase<"Align", 1, "align">,
I32EnumAttrCase<"SeparateStorage", 2, "separate_storage">,
I32EnumAttrCase<"Dereferenceable", 3, "dereferenceable">
]>;
def CIR_AssumeOp : CIR_Op<"assume"> {
let arguments = (ins
CIR_BoolType:$predicate,
DefaultValuedAttr<CIR_AssumeBundleKindAttr,
"::cir::AssumeBundleKind::None">:$bundle_kind,
Variadic<CIR_AnyType>:$bundle_args
);
// cir.assume %true align(%p, %a : !cir.ptr<!void>, !u64i) : !cir.bool
// cir.assume %true : !cir.bool (no bundle; kind defaults to None)
let hasVerifier = 1;
}
```
Gone: `VariadicOfVariadic`, the segment-sizes array, the ~85 lines of custom
`printOpBundles` / `parseOpBundles` in `CIRDialect.cpp`. The (kind absent,
args present) invalid state is structurally gone -- kind is always present,
defaults to `None`. The verifier collapses to a per-kind arity check, which is
the "abstract out each bundle kind" explicit per-kind shape you flagged.
Lowering goes back to a two-branch shape (`LLVM::AssumeOp::build(cond)` for
`None`, `build(cond, stringifyAssumeBundleKind(kind), args)` otherwise) -- not
the branchless parallel-array forward we had, but structurally honest for the
single-bundle case (the two forms are genuinely distinct entry points in the
LLVM dialect builder).
Is this the shape you had in mind, or something else?
https://github.com/llvm/llvm-project/pull/197262
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits