-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][NFC] Mark type converter in populate...
functions as const
#111250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-flang-fir-hlfir @llvm/pr-subscribers-backend-amdgpu Author: Matthias Springer (matthias-springer) ChangesThis commit marks the type converter in Patterns already take a Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a Patch is 140.85 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/111250.diff 115 Files Affected:
diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGen.h b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
index 390f00e1ac77c2..255b1950c84256 100644
--- a/flang/include/flang/Optimizer/CodeGen/CodeGen.h
+++ b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
@@ -72,9 +72,9 @@ std::unique_ptr<mlir::Pass> createLLVMDialectToLLVMPass(
[](llvm::Module &m, llvm::raw_ostream &out) { m.print(out, nullptr); });
/// Populate the given list with patterns that convert from FIR to LLVM.
-void populateFIRToLLVMConversionPatterns(fir::LLVMTypeConverter &converter,
- mlir::RewritePatternSet &patterns,
- fir::FIRToLLVMPassOptions &options);
+void populateFIRToLLVMConversionPatterns(
+ const fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns,
+ fir::FIRToLLVMPassOptions &options);
/// Populate the pattern set with the PreCGRewrite patterns.
void populatePreCGRewritePatterns(mlir::RewritePatternSet &patterns,
diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h b/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h
index 1832d4967b7ecd..04b59da72f6bae 100644
--- a/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h
+++ b/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h
@@ -19,7 +19,7 @@ class LLVMTypeConverter;
/// dialect, utilised in cases where the default OpenMP dialect handling cannot
/// handle all cases for intermingled fir types and operations.
void populateOpenMPFIRToLLVMConversionPatterns(
- LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns);
+ const LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns);
} // namespace fir
diff --git a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h b/flang/include/flang/Optimizer/Transforms/CufOpConversion.h
index 3e13c72cc0e3e4..79ce4ac5c6cbc0 100644
--- a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h
+++ b/flang/include/flang/Optimizer/Transforms/CufOpConversion.h
@@ -22,7 +22,7 @@ class DataLayout;
namespace cuf {
-void populateCUFToFIRConversionPatterns(fir::LLVMTypeConverter &converter,
+void populateCUFToFIRConversionPatterns(const fir::LLVMTypeConverter &converter,
mlir::DataLayout &dl,
mlir::RewritePatternSet &patterns);
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 1cb869bfeb95a8..1611de9e6389a5 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -3823,7 +3823,7 @@ fir::createLLVMDialectToLLVMPass(llvm::raw_ostream &output,
}
void fir::populateFIRToLLVMConversionPatterns(
- fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns,
+ const fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns,
fir::FIRToLLVMPassOptions &options) {
patterns.insert<
AbsentOpConversion, AddcOpConversion, AddrOfOpConversion,
diff --git a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
index 48d6c000ee44a3..da13ed648e44e6 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
@@ -93,6 +93,6 @@ struct MapInfoOpConversion
} // namespace
void fir::populateOpenMPFIRToLLVMConversionPatterns(
- LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns) {
+ const LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns) {
patterns.add<MapInfoOpConversion>(converter);
}
diff --git a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
index 24dc8e2354b120..c573506e233599 100644
--- a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
@@ -583,7 +583,7 @@ class CufOpConversion : public fir::impl::CufOpConversionBase<CufOpConversion> {
} // namespace
void cuf::populateCUFToFIRConversionPatterns(
- fir::LLVMTypeConverter &converter, mlir::DataLayout &dl,
+ const fir::LLVMTypeConverter &converter, mlir::DataLayout &dl,
mlir::RewritePatternSet &patterns) {
patterns.insert<CufAllocOpConversion>(patterns.getContext(), &dl, &converter);
patterns.insert<CufAllocateOpConversion, CufDeallocateOpConversion,
diff --git a/mlir/docs/Bufferization.md b/mlir/docs/Bufferization.md
index 6a49bea9c68c5d..d5a426e09e7ceb 100644
--- a/mlir/docs/Bufferization.md
+++ b/mlir/docs/Bufferization.md
@@ -651,7 +651,7 @@ is very small, and follows the basic pattern of any dialect conversion pass.
```
void mlir::populateTensorBufferizePatterns(
- BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns) {
+ const BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns) {
patterns.add<BufferizeCastOp, BufferizeExtractOp>(typeConverter,
patterns.getContext());
}
diff --git a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
index e445c58fe6c547..e7637a6013e68a 100644
--- a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
+++ b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
@@ -24,7 +24,7 @@ class Pass;
/// Note: The ROCDL target does not support the LLVM bfloat type at this time
/// and so this function will add conversions to change all `bfloat` uses
/// to `i16`.
-void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
+void populateAMDGPUToROCDLConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns,
amdgpu::Chipset chipset);
diff --git a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
index 25b82aed9c968a..173fea7c352d93 100644
--- a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
+++ b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h
@@ -22,7 +22,7 @@ class Pass;
#include "mlir/Conversion/Passes.h.inc"
namespace arith {
-void populateArithToLLVMConversionPatterns(LLVMTypeConverter &converter,
+void populateArithToLLVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
void registerConvertArithToLLVMInterface(DialectRegistry ®istry);
diff --git a/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h b/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h
index bb30deb9dc10e5..a15e56bfdf04bf 100644
--- a/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h
+++ b/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h
@@ -22,7 +22,7 @@ class Pass;
#include "mlir/Conversion/Passes.h.inc"
namespace arith {
-void populateArithToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
+void populateArithToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
std::unique_ptr<OperationPass<>> createConvertArithToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
index 69b01b471dd984..65d6f165c7448d 100644
--- a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
+++ b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
@@ -39,7 +39,7 @@ class ComplexStructBuilder : public StructBuilder {
};
/// Populate the given list with patterns that convert from Complex to LLVM.
-void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter,
+void populateComplexToLLVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
void registerConvertComplexToLLVMInterface(DialectRegistry ®istry);
diff --git a/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h b/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h
index 19dba5b870cb6f..777481f00b3592 100644
--- a/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h
+++ b/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h
@@ -20,7 +20,7 @@ class SPIRVTypeConverter;
/// Appends to a pattern list additional patterns for translating Complex ops
/// to SPIR-V ops.
-void populateComplexToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
+void populateComplexToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
index 35b691b8bc44b5..b88c1e8b20f32b 100644
--- a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
+++ b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
@@ -29,13 +29,13 @@ namespace cf {
/// Collect the patterns to convert from the ControlFlow dialect to LLVM. The
/// conversion patterns capture the LLVMTypeConverter by reference meaning the
/// references have to remain alive during the entire pattern lifetime.
-void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter,
- RewritePatternSet &patterns);
+void populateControlFlowToLLVMConversionPatterns(
+ const LLVMTypeConverter &converter, RewritePatternSet &patterns);
/// Populate the cf.assert to LLVM conversion pattern. If `abortOnFailure` is
/// set to false, the program execution continues when a condition is
/// unsatisfied.
-void populateAssertToLLVMConversionPattern(LLVMTypeConverter &converter,
+void populateAssertToLLVMConversionPattern(const LLVMTypeConverter &converter,
RewritePatternSet &patterns,
bool abortOnFailure = true);
diff --git a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h
index 43578ffffae2dc..6de46960ff8029 100644
--- a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h
+++ b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h
@@ -20,7 +20,7 @@ class SPIRVTypeConverter;
namespace cf {
/// Appends to a pattern list additional patterns for translating ControlFLow
/// ops to SPIR-V ops.
-void populateControlFlowToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
+void populateControlFlowToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
} // namespace cf
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
index 76eb3b5dd11e95..b1ea2740c06059 100644
--- a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
+++ b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
@@ -39,8 +39,8 @@ convertFuncOpToLLVMFuncOp(FunctionOpInterface funcOp,
/// `emitCWrappers` is set, the pattern will also produce functions
/// that pass memref descriptors by pointer-to-structure in addition to the
/// default unpacked form.
-void populateFuncToLLVMFuncOpConversionPattern(LLVMTypeConverter &converter,
- RewritePatternSet &patterns);
+void populateFuncToLLVMFuncOpConversionPattern(
+ const LLVMTypeConverter &converter, RewritePatternSet &patterns);
/// Collect the patterns to convert from the Func dialect to LLVM. The
/// conversion patterns capture the LLVMTypeConverter and the LowerToLLVMOptions
@@ -56,7 +56,7 @@ void populateFuncToLLVMFuncOpConversionPattern(LLVMTypeConverter &converter,
/// needed if `converter.getOptions().useBarePtrCallConv` is `true`, but it's
/// not an error to provide it anyway.
void populateFuncToLLVMConversionPatterns(
- LLVMTypeConverter &converter, RewritePatternSet &patterns,
+ const LLVMTypeConverter &converter, RewritePatternSet &patterns,
const SymbolTable *symbolTable = nullptr);
void registerConvertFuncToLLVMInterface(DialectRegistry ®istry);
diff --git a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h
index 2fa55f40dd9700..68728755a2fbdb 100644
--- a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h
+++ b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h
@@ -21,7 +21,7 @@ class SPIRVTypeConverter;
/// Appends to a pattern list additional patterns for translating Func ops
/// to SPIR-V ops. Also adds the patterns to legalize ops not directly
/// translated to SPIR-V dialect.
-void populateFuncToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
+void populateFuncToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h b/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h
index 20c9f9c394525d..3bf30ae99f2bf1 100644
--- a/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h
+++ b/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h
@@ -21,7 +21,7 @@ class TypeConverter;
#define GEN_PASS_DECL_CONVERTGPUOPSTOLLVMSPVOPS
#include "mlir/Conversion/Passes.h.inc"
-void populateGpuToLLVMSPVConversionPatterns(LLVMTypeConverter &converter,
+void populateGpuToLLVMSPVConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
/// Populates memory space attribute conversion rules for lowering
diff --git a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
index e0f4c71051e506..645e86a4309621 100644
--- a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
+++ b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
@@ -32,16 +32,16 @@ LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type);
void configureGpuToNVVMConversionLegality(ConversionTarget &target);
/// Collect a set of patterns to convert from the GPU dialect to NVVM.
-void populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter,
+void populateGpuToNVVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
/// Populate GpuSubgroupReduce pattern to NVVM. It generates a specific nvvm
/// op that is not available on every GPU.
-void populateGpuSubgroupReduceOpLoweringPattern(LLVMTypeConverter &converter,
- RewritePatternSet &patterns);
+void populateGpuSubgroupReduceOpLoweringPattern(
+ const LLVMTypeConverter &converter, RewritePatternSet &patterns);
/// Collect a set of patterns to convert WMMA ops from GPU dialect to NVVM.
-void populateGpuWMMAToNVVMConversionPatterns(LLVMTypeConverter &converter,
+void populateGpuWMMAToNVVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
index 5647787712997b..1a917932a9a84a 100644
--- a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
+++ b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
@@ -30,7 +30,7 @@ class GPUModuleOp;
/// Collect a set of patterns to convert from the GPU dialect to ROCDL.
/// If `runtime` is Unknown, gpu.printf will not be lowered
/// The resulting pattern set should be run over a gpu.module op
-void populateGpuToROCDLConversionPatterns(LLVMTypeConverter &converter,
+void populateGpuToROCDLConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns,
gpu::amd::Runtime runtime);
diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h
index d34549432161db..825142d120587f 100644
--- a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h
+++ b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h
@@ -23,13 +23,13 @@ class SPIRVTypeConverter;
/// Appends to a pattern list additional patterns for translating GPU Ops to
/// SPIR-V ops. For a gpu.func to be converted, it should have a
/// spirv.entry_point_abi attribute.
-void populateGPUToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
+void populateGPUToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
/// Collect a set of patterns to convert WMMA ops from GPU dialect to SPIRV,
/// using the KHR Cooperative Matrix extension.
void populateGpuWMMAToSPIRVCoopMatrixKHRConversionPatterns(
- SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns);
+ const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns);
/// Adds `MMAMatrixType` conversions to SPIR-V cooperative matrix KHR type
/// conversion to the type converter.
diff --git a/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h b/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h
index df605adae669be..16d3d74b135588 100644
--- a/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h
+++ b/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h
@@ -21,7 +21,7 @@ class Pass;
#include "mlir/Conversion/Passes.h.inc"
namespace index {
-void populateIndexToLLVMConversionPatterns(LLVMTypeConverter &converter,
+void populateIndexToLLVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
void registerConvertIndexToLLVMInterface(DialectRegistry ®istry);
diff --git a/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h b/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h
index 58a1c5246eef99..e5e7d3318a8717 100644
--- a/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h
+++ b/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h
@@ -21,7 +21,7 @@ class Pass;
#include "mlir/Conversion/Passes.h.inc"
namespace index {
-void populateIndexToSPIRVPatterns(SPIRVTypeConverter &converter,
+void populateIndexToSPIRVPatterns(const SPIRVTypeConverter &converter,
RewritePatternSet &patterns);
std::unique_ptr<OperationPass<>> createConvertIndexToSPIRVPass();
} // namespace index
diff --git a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
index 4ddc1637000fdb..93cd780bba4381 100644
--- a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
+++ b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
@@ -21,7 +21,7 @@ class Pass;
#define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS
#include "mlir/Conversion/Passes.h.inc"
-void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
+void populateMathToLLVMConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns,
bool approximateLog1p = true);
diff --git a/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h b/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h
index fa7a635568c7c2..46573e7966cccc 100644
--- a/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h
+++ b/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h
@@ -19,7 +19,7 @@ class Pass;
#include "mlir/Conversion/Passes.h.inc"
/// Populate the given list with patterns that convert from Math to ROCDL calls.
-void populateMathToROCDLConversionPatterns(LLVMTypeConverter &converter,
+void populateMathToROCDLConversionPatterns(const LLVMTypeConverter &converter,
RewritePatternSet &patterns);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h
index 10090268a46636..452b3f5df931e1 100644
--- a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h
+++ b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h
@@ -20,7 +20,7 @@ class SPIRVTypeConverter;
/// Appends to a pattern list additional patterns for translating Math ops
/// to SPIR-V ops.
-void populate...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
4e053c3
to
09b6de3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This commit marks the type converter in `populate...` functions as `const`. This is useful for debugging. Patterns already take a `const` type converter, but some `populate...` patterns do not only add new patterns, but also add additional type conversion rules. That makes it difficult to find the place where a type conversion was added in the code base. With this change, all `populate...` functions that only populate pattern now have a `const` type converter, from which programmers can conclude that they do not register any new type conversion rules. Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a `const` object internally.
09b6de3
to
c1e8445
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/4541 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/117/builds/2546 Here is the relevant piece of the build log for the reference
|
Fix build error that was introduced by #111250. Also, the deleted function is not needed at all.
Fix build error that was introduced by #111250. Also, the deleted function is not needed at all. ``` ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h: In member function ‘const mlir::LLVMTypeConverter* mlir::SPIRVToLLVMConversion<SPIRVOp>::getTypeConverter() const’: ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h:35:12: error: invalid ‘static_cast’ from type ‘const mlir::TypeConverter*’ to type ‘const mlir::LLVMTypeConverter*’ 35 | return static_cast<const LLVMTypeConverter *>( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 | ConversionPattern::getTypeConverter()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h:21:7: note: class type ‘const mlir::LLVMTypeConverter’ is incomplete ```
* commit 'FETCH_HEAD': [X86] combineAndLoadToBZHI - don't do an return early return if we fail to match a load [X86] replace-load-and-with-bzhi.ll - add commuted test cases to show failure to fold [X86] replace-load-and-with-bzhi.ll - cleanup check-prefixes to use X86/X64 for 32/64-bit targets [ExecutionEngine] Avoid repeated hash lookups (NFC) (llvm#111275) [ByteCode] Avoid repeated hash lookups (NFC) (llvm#111273) [StaticAnalyzer] Avoid repeated hash lookups (NFC) (llvm#111272) [CodeGen] Avoid repeated hash lookups (NFC) (llvm#111274) [RISCV] Simplify fixed-vector-fp.ll run lines. NFC [libc++][format][1/3] Adds more benchmarks. (llvm#101803) [X86] combineOrXorWithSETCC - avoid duplicate SDLoc/operands code. NFC. [X86] convertIntLogicToFPLogic - avoid duplicate SDLoc/operands code. NFC. [libc] Clean up some include in `libc`. (llvm#110980) [X86] combineBitOpWithPACK - avoid duplicate SDLoc/operands code. NFC. [X86] combineBitOpWithMOVMSK - avoid duplicate SDLoc/operands code. NFC. [X86] combineBitOpWithShift - avoid duplicate SDLoc/operands code. NFC. [x86] combineMul - use computeKnownBits directly to find MUL_IMM constant splat. [X86] combineSubABS - avoid duplicate SDLoc. NFC. [ValueTypes][RISCV] Add v1bf16 type (llvm#111112) [VPlan] Add additional FOR hoisting test. [clang-tidy] Create bugprone-bitwise-pointer-cast check (llvm#108083) [InstCombine] Canonicalize more geps with constant gep bases and constant offsets. (llvm#110033) [LV] Honor uniform-after-vectorization in setVectorizedCallDecision. [ELF] Pass Ctx & to Arch/ [ELF] Pass Ctx & to Arch/ [libc++] Fix a typo (llvm#111239) [X86] For minsize memset/memcpy, use byte or double-word accesses (llvm#87003) [RISCV] Unify RVBShift_ri and RVBShiftW_ri with Shift_ri and ShiftW_ri. NFC (llvm#111263) Revert "Reapply "[AMDGPU][GlobalISel] Fix load/store of pointer vectors, buffer.*.pN (llvm#110714)" (llvm#111059)" [libc] Add missing include to __support/StringUtil/tables/stdc_errors.h. (llvm#111271) [libc] remove errno.h includes (llvm#110934) [NFC][rtsan] Update docs to include [[clang::blocking]] (llvm#111249) [RISCV] Give ZEXT_H_RV32 and ZEXT_H_RV64 R-type format to match PACK. NFC [mlir][SPIRV] Fix build (2) (llvm#111265) [mlir][SPIRV] Fix build error (llvm#111264) [mlir][NFC] Mark type converter in `populate...` functions as `const` (llvm#111250) [Basic] Avoid repeated hash lookups (NFC) (llvm#111228) [RISCV] Use THShift_ri class instead of RVBShift_ri for TH_TST instruction. NFC [VPlan] Only generate first lane for VPPredInstPHI if no others used. [ELF] Don't call getPPC64TargetInfo outside Driver. NFC [GISel] Don't preserve NSW flag when converting G_MUL of INT_MIN to G_SHL. (llvm#111230) [APInt] Slightly simplify APInt::ashrSlowCase. NFC (llvm#111220) [Sema] Avoid repeated hash lookups (NFC) (llvm#111227) [Affine] Avoid repeated hash lookups (NFC) (llvm#111226) [Driver] Avoid repeated hash lookups (NFC) (llvm#111225) [clang][test] Remove a broken bytecode test [ELF] Pass Ctx & [ELF] Pass Ctx & to Relocations Signed-off-by: kyvangka1610 <[email protected]>
This commit marks the type converter in
populate...
functions asconst
. This is useful for debugging.Patterns already take a
const
type converter. However, somepopulate...
functions do not only add new patterns, but also add additional type conversion rules. That makes it difficult to find the place where a type conversion was added in the code base. With this change, allpopulate...
functions that only populate pattern now have aconst
type converter. Programmers can then conclude from the function signature that these functions do not register any new type conversion rules.Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a
const
object internally.