[Mlir-commits] [mlir] 89eed79 - [MLIR][SPIRVToLLVM] Added module name conversion
George Mitenkov
llvmlistbot at llvm.org
Sat Nov 7 01:50:28 PST 2020
Author: George Mitenkov
Date: 2020-11-07T12:27:44+03:00
New Revision: 89eed79c1fa801f4254c3b20aee6185b274180f4
URL: https://github.com/llvm/llvm-project/commit/89eed79c1fa801f4254c3b20aee6185b274180f4
DIFF: https://github.com/llvm/llvm-project/commit/89eed79c1fa801f4254c3b20aee6185b274180f4.diff
LOG: [MLIR][SPIRVToLLVM] Added module name conversion
Since SPIR-V module has an optional name, this patch
makes a change to pass it to `ModuleOp` during conversion.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D90904
Added:
Modified:
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
index db6a2471a8b4..571e85c70dcd 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
@@ -1269,7 +1269,8 @@ class ModuleConversionPattern : public SPIRVToLLVMConversion<spirv::ModuleOp> {
matchAndRewrite(spirv::ModuleOp spvModuleOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
- auto newModuleOp = rewriter.create<ModuleOp>(spvModuleOp.getLoc());
+ auto newModuleOp =
+ rewriter.create<ModuleOp>(spvModuleOp.getLoc(), spvModuleOp.getName());
rewriter.inlineRegionBefore(spvModuleOp.body(), newModuleOp.getBody());
// Remove the terminator block that was automatically added by builder
diff --git a/mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir
index b8169a19ee22..a2dbd19c0ab4 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/module-ops-to-llvm.mlir
@@ -7,6 +7,9 @@
// CHECK: module
spv.module Logical GLSL450 {}
+// CHECK: module @foo
+spv.module @foo Logical GLSL450 {}
+
// CHECK: module
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], [SPV_KHR_16bit_storage]> {}
More information about the Mlir-commits
mailing list