@@ -3438,7 +3438,44 @@ void InlineAsmOp::getEffects(
34383438void LLVM::AssumeOp::build (OpBuilder &builder, OperationState &state,
34393439 mlir::Value cond) {
34403440 return build (builder, state, cond, /* op_bundle_operands=*/ {},
3441- /* op_bundle_tags=*/ {});
3441+ /* op_bundle_tags=*/ ArrayAttr{});
3442+ }
3443+
3444+ void LLVM::AssumeOp::build (OpBuilder &builder, OperationState &state,
3445+ Value cond,
3446+ ArrayRef<llvm::OperandBundleDefT<Value>> opBundles) {
3447+ SmallVector<ValueRange> opBundleOperands;
3448+ SmallVector<Attribute> opBundleTags;
3449+ opBundleOperands.reserve (opBundles.size ());
3450+ opBundleTags.reserve (opBundles.size ());
3451+
3452+ for (const llvm::OperandBundleDefT<Value> &bundle : opBundles) {
3453+ opBundleOperands.emplace_back (bundle.inputs ());
3454+ opBundleTags.push_back (
3455+ StringAttr::get (builder.getContext (), bundle.getTag ()));
3456+ }
3457+
3458+ auto opBundleTagsAttr = ArrayAttr::get (builder.getContext (), opBundleTags);
3459+ return build (builder, state, cond, opBundleOperands, opBundleTagsAttr);
3460+ }
3461+
3462+ void LLVM::AssumeOp::build (OpBuilder &builder, OperationState &state,
3463+ Value cond, llvm::StringRef tag, ValueRange args) {
3464+ llvm::OperandBundleDefT<Value> opBundle (
3465+ tag.str (), SmallVector<Value>(args.begin (), args.end ()));
3466+ return build (builder, state, cond, opBundle);
3467+ }
3468+
3469+ void LLVM::AssumeOp::build (OpBuilder &builder, OperationState &state,
3470+ Value cond, AssumeAlignTag, Value ptr, Value align) {
3471+ return build (builder, state, cond, " align" , ValueRange{ptr, align});
3472+ }
3473+
3474+ void LLVM::AssumeOp::build (OpBuilder &builder, OperationState &state,
3475+ Value cond, AssumeSeparateStorageTag, Value ptr1,
3476+ Value ptr2) {
3477+ return build (builder, state, cond, " separate_storage" ,
3478+ ValueRange{ptr1, ptr2});
34423479}
34433480
34443481LogicalResult LLVM::AssumeOp::verify () { return verifyOperandBundles (*this ); }
0 commit comments