This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Make UnitAttr's default val in unwrapped builder
ClosedPublic

Authored by jpienaar on Oct 2 2022, 9:32 PM.

Details

Summary

UnitAttr is optional but unwrapped builders require it. Make Change onstructing
from bool as required for when not set at moment (for UnitAttr nothing needs to
be constructed, this is true for others here too and can be addressed
together).

Related to #57118

Diff Detail

Event Timeline

jpienaar created this revision.Oct 2 2022, 9:32 PM
jpienaar requested review of this revision.Oct 2 2022, 9:32 PM
rriddle accepted this revision.Oct 2 2022, 11:00 PM
rriddle added inline comments.
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
2149
This revision is now accepted and ready to land.Oct 2 2022, 11:00 PM
This revision was landed with ongoing or failed builds.Oct 5 2022, 10:41 AM
This revision was automatically updated to reflect the committed changes.

FYI, this change breaks Flang build:

In file included from /llvm-project/flang/include/flang/Lower/AbstractConverter.h:21,
                 from /llvm-project/flang/include/flang/Lower/Bridge.h:17,
                 from /llvm-project/flang/lib/Lower/OpenMP.cpp:15:
/llvm-project/mlir/include/mlir/IR/Builders.h: In instantiation of ‘OpTy mlir::OpBuilder::create(mlir::Location, Args&& ...) [with OpTy = mlir::omp::OrderedRegionOp; Args = {std::nullptr_t}]’:
/llvm-project/flang/lib/Lower/OpenMP.cpp:844:42:   required from here
/llvm-project/mlir/include/mlir/IR/Builders.h:460:16: error: call of overloaded ‘build(mlir::OpBuilder&, mlir::OperationState&, std::nullptr_t)’ is ambiguous
  460 |     OpTy::build(*this, state, std::forward<Args>(args)...);
      |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h:33,
                 from /llvm-project/flang/lib/Lower/OpenMP.cpp:25:
/llvm-project/build/tools/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.h.inc:1320:15: note: candidate: ‘static void mlir::omp::OrderedRegionOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::UnitAttr)’
 1320 |   static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::UnitAttr simd);
      |               ^~~~~
/llvm-project/build/tools/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.h.inc:1323:15: note: candidate: ‘static void mlir::omp::OrderedRegionOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::TypeRange, bool)’
 1323 |   static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool simd = false);
      |               ^~~~~

FYI, this change breaks Flang build:

Fixed build failure in D135308.