Skip to content

Commit 46795c8

Browse files
committed
address more comments
1 parent 7e7add4 commit 46795c8

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,8 @@ struct VectorExtractOpConvert final
154154
return success();
155155
}
156156

157-
std::optional<int64_t> id =
158-
getConstantIntValue(extractOp.getMixedPosition()[0]);
159-
160-
if (id.has_value())
157+
if (std::optional<int64_t> id =
158+
getConstantIntValue(extractOp.getMixedPosition()[0]))
161159
rewriter.replaceOpWithNewOp<spirv::CompositeExtractOp>(
162160
extractOp, dstType, adaptor.getVector(),
163161
rewriter.getI32ArrayAttr(id.value()));
@@ -242,10 +240,8 @@ struct VectorInsertOpConvert final
242240
return success();
243241
}
244242

245-
std::optional<int64_t> id =
246-
getConstantIntValue(insertOp.getMixedPosition()[0]);
247-
248-
if (id.has_value())
243+
if (std::optional<int64_t> id =
244+
getConstantIntValue(insertOp.getMixedPosition()[0]))
249245
rewriter.replaceOpWithNewOp<spirv::CompositeInsertOp>(
250246
insertOp, adaptor.getSource(), adaptor.getDest(), id.value());
251247
else

0 commit comments

Comments
 (0)