Skip to content

Commit d61481d

Browse files
committed
Address review comments
1 parent 4d6453c commit d61481d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,15 +743,14 @@ struct VectorLoadOpConverter final
743743

744744
auto vectorPtrType = spirv::PointerType::get(spirvVectorType, storageClass);
745745

746-
auto alignment = loadOp.getAlignment();
747-
if (alignment.has_value() &&
748-
alignment > std::numeric_limits<uint32_t>::max()) {
746+
std::optional<uint64_t> alignment = loadOp.getAlignment();
747+
if (alignment > std::numeric_limits<uint32_t>::max()) {
749748
return rewriter.notifyMatchFailure(loadOp,
750749
"invalid alignment requirement");
751750
}
752751

753752
auto memoryAccess = spirv::MemoryAccess::None;
754-
auto memoryAccessAttr = spirv::MemoryAccessAttr{};
753+
spirv::MemoryAccessAttr memoryAccessAttr;
755754
IntegerAttr alignmentAttr = nullptr;
756755
if (alignment.has_value()) {
757756
memoryAccess = memoryAccess | spirv::MemoryAccess::Aligned;
@@ -800,8 +799,8 @@ struct VectorStoreOpConverter final
800799
return rewriter.notifyMatchFailure(
801800
storeOp, "failed to get memref element pointer");
802801

803-
auto alignment = storeOp.getAlignment();
804-
if (alignment && alignment > std::numeric_limits<uint32_t>::max()) {
802+
std::optional<uint64_t> alignment = storeOp.getAlignment();
803+
if (alignment > std::numeric_limits<uint32_t>::max()) {
805804
return rewriter.notifyMatchFailure(storeOp,
806805
"invalid alignment requirement");
807806
}
@@ -820,7 +819,7 @@ struct VectorStoreOpConverter final
820819
accessChain);
821820

822821
auto memoryAccess = spirv::MemoryAccess::None;
823-
auto memoryAccessAttr = spirv::MemoryAccessAttr{};
822+
spirv::MemoryAccessAttr memoryAccessAttr;
824823
IntegerAttr alignmentAttr = nullptr;
825824
if (alignment.has_value()) {
826825
memoryAccess = memoryAccess | spirv::MemoryAccess::Aligned;

mlir/test/Dialect/SPIRV/IR/invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -split-input-file -verify-diagnostics %s
1+
// RUN: mlir-opt --split-input-file --verify-diagnostics %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.LoadOp

0 commit comments

Comments
 (0)