diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -286,22 +286,10 @@ OptionalAttr:$order_val, UnitAttr:$inclusive); - let skipDefaultBuilders = 1; - let builders = [ OpBuilder<(ins "ValueRange":$lowerBound, "ValueRange":$upperBound, "ValueRange":$step, CArg<"ArrayRef", "{}">:$attributes)>, - OpBuilder<(ins "TypeRange":$resultTypes, "ValueRange":$lowerBound, - "ValueRange":$upperBound, "ValueRange":$step, - "ValueRange":$linear_vars, "ValueRange":$linear_step_vars, - "ValueRange":$reduction_vars, "StringAttr":$schedule_val, - "Value":$schedule_chunk_var, "IntegerAttr":$collapse_val, - "UnitAttr":$nowait, "IntegerAttr":$ordered_val, - "StringAttr":$order_val, "UnitAttr":$inclusive, - CArg<"bool", "true">:$buildBody)>, - OpBuilder<(ins "TypeRange":$resultTypes, "ValueRange":$operands, - CArg<"ArrayRef", "{}">:$attributes)> ]; let regions = (region AnyRegion:$region); diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1005,73 +1005,16 @@ void WsLoopOp::build(OpBuilder &builder, OperationState &state, ValueRange lowerBound, ValueRange upperBound, ValueRange step, ArrayRef attributes) { - build(builder, state, TypeRange(), lowerBound, upperBound, step, - /*linear_vars=*/ValueRange(), /*linear_step_vars=*/ValueRange(), - /*reduction_vars=*/ValueRange(), /*schedule_val=*/nullptr, - /*schedule_chunk_var=*/nullptr, /*collapse_val=*/nullptr, - /*nowait=*/nullptr, /*ordered_val=*/nullptr, /*order_val=*/nullptr, - /*inclusive=*/nullptr, /*buildBody=*/false); + build(builder, state, lowerBound, upperBound, step, + /*linear_vars=*/ValueRange(), + /*linear_step_vars=*/ValueRange(), /*reduction_vars=*/ValueRange(), + /*reductions=*/nullptr, /*schedule_val=*/nullptr, + /*schedule_chunk_var=*/nullptr, /*schedule_modifier=*/nullptr, + /*simd_modifier=*/false, /*collapse_val=*/nullptr, /*nowait=*/false, + /*ordered_val=*/nullptr, /*order_val=*/nullptr, /*inclusive=*/false); state.addAttributes(attributes); } -void WsLoopOp::build(OpBuilder &, OperationState &state, TypeRange resultTypes, - ValueRange operands, ArrayRef attributes) { - state.addOperands(operands); - state.addAttributes(attributes); - (void)state.addRegion(); - assert(resultTypes.empty() && "mismatched number of return types"); - state.addTypes(resultTypes); -} - -void WsLoopOp::build(OpBuilder &builder, OperationState &result, - TypeRange typeRange, ValueRange lowerBounds, - ValueRange upperBounds, ValueRange steps, - ValueRange linearVars, ValueRange linearStepVars, - ValueRange reductionVars, StringAttr scheduleVal, - Value scheduleChunkVar, IntegerAttr collapseVal, - UnitAttr nowait, IntegerAttr orderedVal, - StringAttr orderVal, UnitAttr inclusive, bool buildBody) { - result.addOperands(lowerBounds); - result.addOperands(upperBounds); - result.addOperands(steps); - result.addOperands(linearVars); - result.addOperands(linearStepVars); - if (scheduleChunkVar) - result.addOperands(scheduleChunkVar); - - if (scheduleVal) - result.addAttribute("schedule_val", scheduleVal); - if (collapseVal) - result.addAttribute("collapse_val", collapseVal); - if (nowait) - result.addAttribute("nowait", nowait); - if (orderedVal) - result.addAttribute("ordered_val", orderedVal); - if (orderVal) - result.addAttribute("order", orderVal); - if (inclusive) - result.addAttribute("inclusive", inclusive); - result.addAttribute( - WsLoopOp::getOperandSegmentSizeAttr(), - builder.getI32VectorAttr( - {static_cast(lowerBounds.size()), - static_cast(upperBounds.size()), - static_cast(steps.size()), - static_cast(linearVars.size()), - static_cast(linearStepVars.size()), - static_cast(reductionVars.size()), - static_cast(scheduleChunkVar != nullptr ? 1 : 0)})); - - Region *bodyRegion = result.addRegion(); - if (buildBody) { - OpBuilder::InsertionGuard guard(builder); - unsigned numIVs = steps.size(); - SmallVector argTypes(numIVs, steps.getType().front()); - SmallVector argLocs(numIVs, result.location); - builder.createBlock(bodyRegion, {}, argTypes, argLocs); - } -} - LogicalResult WsLoopOp::verify() { return verifyReductionVarList(*this, reductions(), reduction_vars()); }