[Mlir-commits] [mlir] [mlir] Use {} instead of std::nullopt to initialize empty ArrayRef (PR #109527)

Jay Foad llvmlistbot at llvm.org
Sat Sep 21 02:54:21 PDT 2024


================
@@ -249,8 +249,8 @@ static Value createLinalgBodyCalculationForElementwiseOp(
     auto shifted =
         rewriter.create<arith::ShRSIOp>(loc, resultTypes, args[0], subtract)
             ->getResults();
-    auto truncated =
-        rewriter.create<arith::TruncIOp>(loc, i1Ty, shifted, std::nullopt);
+    auto truncated = rewriter.create<arith::TruncIOp>(
+        loc, i1Ty, shifted, llvm::ArrayRef<NamedAttribute>());
----------------
jayfoad wrote:

If I understand correctly, you can't use `{}` in calls to `create<>` because the arguments get passed on with `std::forward` which does not work with initializer lists - but I'm not an expert.

https://github.com/llvm/llvm-project/pull/109527


More information about the Mlir-commits mailing list