================
@@ -6144,19 +6144,47 @@ def CIR_IsFPClassOp : CIR_Op<"is_fp_class", [Pure]> {
def CIR_AssumeOp : CIR_Op<"assume"> {
let summary = "Tell the optimizer that a boolean value is true";
let description = [{
- The `cir.assume` operation takes a single boolean prediate as its only
+ The `cir.assume` operation takes a single boolean predicate as its first
argument and does not have any results. The operation tells the optimizer
that the predicate is always true.
+ An optional operand bundle (tag + variadic args) can be attached to carry
+ additional assumption metadata, mirroring LLVM dialect's `llvm.assume`
+ bundles. For example, `__builtin_assume_dereferenceable(p, n)` lowers
+ to `cir.assume %true ["dereferenceable"(%p, %n : !cir.ptr<!void>, !u64i)]`,
+ which in turn lowers to
+ `call void @llvm.assume(i1 true) [ "dereferenceable"(ptr, i64) ]`.
+
This operation corresponds to the `__assume` and the `__builtin_assume`
- builtin functions.
+ builtin functions, and (with a bundle) to other `__builtin_assume_*`
+ variants such as `__builtin_assume_dereferenceable`.
}];
- let arguments = (ins CIR_BoolType:$predicate);
+ let arguments = (ins
+ CIR_BoolType:$predicate,
+ OptionalAttr<StrAttr>:$bundle_tag,
----------------
erichkeane wrote:
Its a little odd that the tag is a string and not an enum. Also, since these
two have to stay in sync, there should probably be a pair-type for the tag/args
pair.
That would also remove the need for the 'verifier'.
https://github.com/llvm/llvm-project/pull/197262
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits