[Mlir-commits] [mlir] [mlir][spirv] Handle failed conversions of struct elements (PR #70005)

Jakub Kuderski llvmlistbot at llvm.org
Thu Oct 26 08:26:04 PDT 2023


================
@@ -207,21 +207,19 @@ convertStructTypeWithOffset(spirv::StructType type,
   if (type != VulkanLayoutUtils::decorateType(type))
     return std::nullopt;
 
-  auto elementsVector = llvm::to_vector<8>(
-      llvm::map_range(type.getElementTypes(), [&](Type elementType) {
-        return converter.convertType(elementType);
-      }));
+  SmallVector<Type> elementsVector;
+  if (converter.convertTypes(type.getElementTypes(), elementsVector).failed())
----------------
kuhar wrote:

Prefer `if (failed(...))`

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


More information about the Mlir-commits mailing list