[Mlir-commits] [mlir] b34fb27 - [mlir][cf] Implement missing SwitchOp::build function
Alexander Batashev
llvmlistbot at llvm.org
Thu Jun 2 23:08:44 PDT 2022
Author: Alexander Batashev
Date: 2022-06-03T09:08:04+03:00
New Revision: b34fb277df672ca2de2721702b53bbb91f1d68dc
URL: https://github.com/llvm/llvm-project/commit/b34fb277df672ca2de2721702b53bbb91f1d68dc
DIFF: https://github.com/llvm/llvm-project/commit/b34fb277df672ca2de2721702b53bbb91f1d68dc.diff
LOG: [mlir][cf] Implement missing SwitchOp::build function
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D126594
Added:
Modified:
mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp b/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
index 6b6511101bc36..aaaf390826d67 100644
--- a/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
+++ b/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
@@ -475,6 +475,20 @@ void SwitchOp::build(OpBuilder &builder, OperationState &result, Value value,
caseValuesAttr, caseDestinations, caseOperands);
}
+void SwitchOp::build(OpBuilder &builder, OperationState &result, Value value,
+ Block *defaultDestination, ValueRange defaultOperands,
+ ArrayRef<int32_t> caseValues, BlockRange caseDestinations,
+ ArrayRef<ValueRange> caseOperands) {
+ DenseIntElementsAttr caseValuesAttr;
+ if (!caseValues.empty()) {
+ ShapedType caseValueType = VectorType::get(
+ static_cast<int64_t>(caseValues.size()), value.getType());
+ caseValuesAttr = DenseIntElementsAttr::get(caseValueType, caseValues);
+ }
+ build(builder, result, value, defaultDestination, defaultOperands,
+ caseValuesAttr, caseDestinations, caseOperands);
+}
+
/// <cases> ::= `default` `:` bb-id (`(` ssa-use-and-type-list `)`)?
/// ( `,` integer `:` bb-id (`(` ssa-use-and-type-list `)`)? )*
static ParseResult parseSwitchOpCases(
More information about the Mlir-commits
mailing list