[PATCH] D73419: [mlir][spirv] NFC: simplify load/store builder call sites
Lei Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 25 08:02:15 PST 2020
antiagainst created this revision.
antiagainst added reviewers: benvanik, denis13.
Herald added subscribers: llvm-commits, liufengdb, lucyrfox, mgester, arpith-jacob, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: mravishankar.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.
This commit introduces default values for load/store builders to
simplify builder call sites.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73419
Files:
mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
Index: mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
===================================================================
--- mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
+++ mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
@@ -191,9 +191,7 @@
spirv::ConstantOp::getZero(indexType, funcOp.getLoc(), &rewriter);
auto loadPtr = rewriter.create<spirv::AccessChainOp>(
funcOp.getLoc(), replacement, zero.constant());
- replacement = rewriter.create<spirv::LoadOp>(funcOp.getLoc(), loadPtr,
- /*memory_access=*/nullptr,
- /*alignment=*/nullptr);
+ replacement = rewriter.create<spirv::LoadOp>(funcOp.getLoc(), loadPtr);
}
signatureConverter.remapInput(argType.index(), replacement);
}
Index: mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
===================================================================
--- mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
+++ mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
@@ -241,9 +241,7 @@
spirv::GlobalVariableOp varOp =
getOrInsertBuiltinVariable(moduleOp, op->getLoc(), builtin, builder);
Value ptr = builder.create<spirv::AddressOfOp>(op->getLoc(), varOp);
- return builder.create<spirv::LoadOp>(op->getLoc(), ptr,
- /*memory_access =*/nullptr,
- /*alignment =*/nullptr);
+ return builder.create<spirv::LoadOp>(op->getLoc(), ptr);
}
//===----------------------------------------------------------------------===//
Index: mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
===================================================================
--- mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
+++ mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
@@ -334,9 +334,7 @@
auto loadPtr = getElementPtr(rewriter, typeConverter, loadOp.getLoc(),
loadOp.memref().getType().cast<MemRefType>(),
loadOperands.memref(), loadOperands.indices());
- rewriter.replaceOpWithNewOp<spirv::LoadOp>(loadOp, loadPtr,
- /*memory_access =*/nullptr,
- /*alignment =*/nullptr);
+ rewriter.replaceOpWithNewOp<spirv::LoadOp>(loadOp, loadPtr);
return matchSuccess();
}
@@ -381,9 +379,7 @@
storeOp.memref().getType().cast<MemRefType>(),
storeOperands.memref(), storeOperands.indices());
rewriter.replaceOpWithNewOp<spirv::StoreOp>(storeOp, storePtr,
- storeOperands.value(),
- /*memory_access =*/nullptr,
- /*alignment =*/nullptr);
+ storeOperands.value());
return matchSuccess();
}
Index: mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
===================================================================
--- mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
+++ mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
@@ -262,9 +262,13 @@
SPV_Type:$value
);
- let builders = [OpBuilder<[{Builder *builder, OperationState &state,
- Value basePtr, /*optional*/IntegerAttr memory_access,
- /*optional*/IntegerAttr alignment}]>];
+ let builders = [
+ OpBuilder<[{
+ Builder *builder, OperationState &state,
+ Value basePtr, /*optional*/IntegerAttr memory_access = {},
+ /*optional*/IntegerAttr alignment = {}
+ }]>
+ ];
}
// -----
@@ -358,7 +362,7 @@
let builders = [
OpBuilder<"Builder *builder, OperationState &state, "
- "Value ptr, Value value, ArrayRef<NamedAttribute> namedAttrs", [{
+ "Value ptr, Value value, ArrayRef<NamedAttribute> namedAttrs = {}", [{
state.addOperands(ptr);
state.addOperands(value);
state.addAttributes(namedAttrs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73419.240383.patch
Type: text/x-patch
Size: 4046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200125/3cc5ac3f/attachment.bin>
More information about the llvm-commits
mailing list