[all-commits] [llvm/llvm-project] 5c8ce6: [mlir] Move casting method calls to function calls
Tres via All-commits
all-commits at lists.llvm.org
Fri May 12 02:52:45 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5c8ce6d5761ed6a9a39ef5a77aa45d8b6095e0f5
https://github.com/llvm/llvm-project/commit/5c8ce6d5761ed6a9a39ef5a77aa45d8b6095e0f5
Author: Tres Popp <tpopp at google.com>
Date: 2023-05-12 (Fri, 12 May 2023)
Changed paths:
M mlir/examples/toy/Ch3/mlir/ToyCombine.td
M mlir/examples/toy/Ch4/mlir/ToyCombine.td
M mlir/examples/toy/Ch5/mlir/ToyCombine.td
M mlir/examples/toy/Ch6/mlir/ToyCombine.td
M mlir/examples/toy/Ch7/include/toy/Ops.td
M mlir/examples/toy/Ch7/mlir/ToyCombine.td
M mlir/include/mlir/Dialect/AMX/AMX.td
M mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td
M mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
M mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
M mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
M mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
M mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td
M mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
M mlir/include/mlir/Dialect/DLTI/DLTIBase.td
M mlir/include/mlir/Dialect/Func/IR/FuncOps.td
M mlir/include/mlir/Dialect/GPU/IR/GPUBase.td
M mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
M mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
M mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
M mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.td
M mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td
M mlir/include/mlir/Dialect/PDL/IR/PDLTypes.td
M mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
M mlir/include/mlir/Dialect/Quant/QuantOpsBase.td
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCompositeOps.td
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.td
M mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
M mlir/include/mlir/Dialect/Tosa/IR/TosaTypesBase.td
M mlir/include/mlir/Dialect/Transform/IR/TransformTypes.td
M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
M mlir/include/mlir/Dialect/X86Vector/X86Vector.td
M mlir/include/mlir/IR/AttrTypeBase.td
M mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
M mlir/include/mlir/IR/BuiltinAttributes.td
M mlir/include/mlir/IR/BuiltinDialectBytecode.td
M mlir/include/mlir/IR/BuiltinTypes.td
M mlir/include/mlir/IR/EnumAttr.td
M mlir/include/mlir/IR/OpBase.td
M mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td
M mlir/include/mlir/Interfaces/VectorInterfaces.td
M mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td
M mlir/test/lib/Dialect/Test/TestOps.td
M mlir/test/mlir-pdll/Parser/include_td.pdll
M mlir/test/mlir-tblgen/interfaces-as-constraints.td
M mlir/test/mlir-tblgen/op-attribute.td
M mlir/test/mlir-tblgen/predicate.td
Log Message:
-----------
[mlir] Move casting method calls to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change continues the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
This commit attempts to update all occurrences of the casts in .td
files, although it is likely that a couple were missed.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
Unfortunatley, this was not automated, but was handled by mindlessly
going to next occurrences of patterns, selecting the piece of code to
be moved into the function call, and running a vim macro over the span
of around 4 hours.
Differential Revision: https://reviews.llvm.org/D150199
Commit: 5550c821897ab77e664977121a0e90ad5be1ff59
https://github.com/llvm/llvm-project/commit/5550c821897ab77e664977121a0e90ad5be1ff59
Author: Tres Popp <tpopp at google.com>
Date: 2023-05-12 (Fri, 12 May 2023)
Changed paths:
M mlir/include/mlir/Bytecode/BytecodeImplementation.h
M mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
M mlir/include/mlir/Conversion/MemRefToLLVM/AllocLikeConversion.h
M mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h
M mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
M mlir/include/mlir/Dialect/Arith/IR/Arith.h
M mlir/include/mlir/Dialect/Async/IR/Async.h
M mlir/include/mlir/Dialect/CommonFolders.h
M mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h
M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
M mlir/include/mlir/Dialect/Quant/UniformSupport.h
M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h
M mlir/include/mlir/Dialect/Tosa/Utils/ConversionUtils.h
M mlir/include/mlir/Dialect/Tosa/Utils/ShapeUtils.h
M mlir/include/mlir/Dialect/Transform/IR/MatchInterfaces.h
M mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
M mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
M mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
M mlir/include/mlir/Interfaces/InferTypeOpInterface.h
M mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
M mlir/include/mlir/Transforms/DialectConversion.h
M mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
M mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
M mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
M mlir/lib/Analysis/Liveness.cpp
M mlir/lib/Analysis/SliceAnalysis.cpp
M mlir/lib/AsmParser/AsmParserState.cpp
M mlir/lib/AsmParser/AttributeParser.cpp
M mlir/lib/AsmParser/DialectSymbolParser.cpp
M mlir/lib/AsmParser/Parser.cpp
M mlir/lib/AsmParser/Parser.h
M mlir/lib/AsmParser/TypeParser.cpp
M mlir/lib/Bytecode/Reader/BytecodeReader.cpp
M mlir/lib/Bytecode/Writer/IRNumbering.cpp
M mlir/lib/CAPI/Dialect/PDL.cpp
M mlir/lib/CAPI/Dialect/Quant.cpp
M mlir/lib/CAPI/Dialect/SparseTensor.cpp
M mlir/lib/CAPI/Dialect/Transform.cpp
M mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
M mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
M mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
M mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
M mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
M mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
M mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
M mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
M mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
M mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
M mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp
M mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
M mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
M mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp
M mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
M mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
M mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
M mlir/lib/Conversion/LLVMCommon/Pattern.cpp
M mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
M mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp
M mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
M mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
M mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
M mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
M mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp
M mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp
M mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
M mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
M mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
M mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
M mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
M mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
M mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
M mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
M mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
M mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
M mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
M mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
M mlir/lib/Conversion/TosaToArith/TosaToArith.cpp
M mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
M mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
M mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
M mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
M mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
M mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
M mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp
M mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
M mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
M mlir/lib/Dialect/Affine/Analysis/Utils.cpp
M mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
M mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
M mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
M mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
M mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
M mlir/lib/Dialect/Affine/Utils/Utils.cpp
M mlir/lib/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
M mlir/lib/Dialect/Arith/Transforms/ReifyValueBounds.cpp
M mlir/lib/Dialect/Arith/Utils/Utils.cpp
M mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
M mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
M mlir/lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp
M mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
M mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
M mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
M mlir/lib/Dialect/Bufferization/Transforms/BufferUtils.cpp
M mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
M mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
M mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
M mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
M mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
M mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
M mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
M mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
M mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
M mlir/lib/Dialect/GPU/Transforms/MemoryPromotion.cpp
M mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp
M mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
M mlir/lib/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp
M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
M mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
M mlir/lib/Dialect/Linalg/Transforms/ConvertConv2DToImg2Col.cpp
M mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
M mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
M mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
M mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
M mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
M mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
M mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
M mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
M mlir/lib/Dialect/Linalg/Transforms/FusePadOpWithLinalgProducer.cpp
M mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
M mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
M mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
M mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
M mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
M mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
M mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
M mlir/lib/Dialect/Linalg/Transforms/Split.cpp
M mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
M mlir/lib/Dialect/Linalg/Transforms/SubsetHoisting.cpp
M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
M mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
M mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
M mlir/lib/Dialect/Linalg/Utils/IndexingUtils.cpp
M mlir/lib/Dialect/Linalg/Utils/Utils.cpp
M mlir/lib/Dialect/Math/Transforms/AlgebraicSimplification.cpp
M mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
M mlir/lib/Dialect/MemRef/TransformOps/MemRefTransformOps.cpp
M mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp
M mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp
M mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
M mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp
M mlir/lib/Dialect/MemRef/Transforms/ExtractAddressComputations.cpp
M mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
M mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
M mlir/lib/Dialect/MemRef/Transforms/MultiBuffer.cpp
M mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
M mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
M mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
M mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
M mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
M mlir/lib/Dialect/NVGPU/Utils/MMAUtils.cpp
M mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
M mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
M mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
M mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
M mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
M mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
M mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
M mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
M mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
M mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp
M mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
M mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
M mlir/lib/Dialect/SPIRV/Utils/LayoutUtils.cpp
M mlir/lib/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
M mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
M mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h
M mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseStorageSpecifierToLLVM.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorStorageLayout.h
M mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
M mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
M mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/Tensor/Transforms/ExtractSliceFromReshapeUtils.cpp
M mlir/lib/Dialect/Tensor/Utils/Utils.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeConv2D.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeDepthwise.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaFoldConstantTranspose.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
M mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
M mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp
M mlir/lib/Dialect/Traits.cpp
M mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
M mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
M mlir/lib/Dialect/Utils/StaticValueUtils.cpp
M mlir/lib/Dialect/Utils/StructuredOpsUtils.cpp
M mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorMask.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorDropLeadUnitDim.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorInsertExtractStridedSliceRewritePatterns.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
M mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
M mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
M mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp
M mlir/lib/ExecutionEngine/JitRunner.cpp
M mlir/lib/Interfaces/DataLayoutInterfaces.cpp
M mlir/lib/Interfaces/DestinationStyleOpInterface.cpp
M mlir/lib/Interfaces/InferIntRangeInterface.cpp
M mlir/lib/Interfaces/InferTypeOpInterface.cpp
M mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
M mlir/lib/Rewrite/ByteCode.cpp
M mlir/lib/Target/Cpp/TranslateToCpp.cpp
M mlir/lib/Target/LLVMIR/DebugTranslation.cpp
M mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
M mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMPCommon.cpp
M mlir/lib/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.cpp
M mlir/lib/Target/LLVMIR/LoopAnnotationTranslation.cpp
M mlir/lib/Target/LLVMIR/ModuleImport.cpp
M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
M mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
M mlir/lib/Target/SPIRV/Deserialization/Deserializer.h
M mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp
M mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
M mlir/lib/Target/SPIRV/Serialization/Serializer.h
M mlir/lib/Tools/PDLL/CodeGen/MLIRGen.cpp
M mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
M mlir/lib/Transforms/CSE.cpp
M mlir/lib/Transforms/Inliner.cpp
M mlir/lib/Transforms/Mem2Reg.cpp
M mlir/lib/Transforms/Utils/DialectConversion.cpp
M mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp
M mlir/lib/Transforms/Utils/RegionUtils.cpp
M mlir/lib/Transforms/ViewOpGraph.cpp
M mlir/test/lib/Analysis/TestAliasAnalysis.cpp
M mlir/test/lib/Analysis/TestMemRefStrideCalculation.cpp
M mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp
M mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
M mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
M mlir/test/lib/Dialect/Func/TestDecomposeCallGraphTypes.cpp
M mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp
M mlir/test/lib/Dialect/Shape/TestShapeFunctions.cpp
M mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp
M mlir/test/lib/Dialect/Test/TestDialect.cpp
M mlir/test/lib/Dialect/Test/TestPatterns.cpp
M mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
M mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp
M mlir/test/lib/IR/TestBuiltinAttributeInterfaces.cpp
M mlir/test/lib/IR/TestDiagnostics.cpp
M mlir/test/lib/IR/TestFunc.cpp
M mlir/test/lib/IR/TestInterfaces.cpp
M mlir/test/lib/IR/TestOpaqueLoc.cpp
M mlir/test/lib/IR/TestPrintDefUse.cpp
M mlir/test/lib/Transforms/TestTopologicalSort.cpp
M mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
M mlir/unittests/Dialect/LLVMIR/LLVMTypeTest.cpp
M mlir/unittests/IR/AttributeTest.cpp
M mlir/unittests/IR/InterfaceAttachmentTest.cpp
M mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp
M mlir/unittests/Pass/PassManagerTest.cpp
Log Message:
-----------
[mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.
Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.
Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
additional check:
https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
them to a pure state.
4. Some changes have been deleted for the following reasons:
- Some files had a variable also named cast
- Some files had not included a header file that defines the cast
functions
- Some files are definitions of the classes that have the casting
methods, so the code still refers to the method instead of the
function without adding a prefix or removing the method declaration
at the same time.
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-header-filter=mlir/ mlir/* -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
mlir/lib/**/IR/\
mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
mlir/test/lib/Dialect/Test/TestTypes.cpp\
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
mlir/test/lib/Dialect/Test/TestAttributes.cpp\
mlir/unittests/TableGen/EnumsGenTest.cpp\
mlir/test/python/lib/PythonTestCAPI.cpp\
mlir/include/mlir/IR/
```
Differential Revision: https://reviews.llvm.org/D150123
Commit: c1fa60b4cde512964544ab66404dea79dbc5dcb4
https://github.com/llvm/llvm-project/commit/c1fa60b4cde512964544ab66404dea79dbc5dcb4
Author: Tres Popp <tpopp at google.com>
Date: 2023-05-12 (Fri, 12 May 2023)
Changed paths:
M mlir/include/mlir/IR/Builders.h
M mlir/include/mlir/IR/BuiltinAttributes.h
M mlir/include/mlir/IR/BuiltinTypes.h
M mlir/include/mlir/IR/FunctionInterfaces.h
M mlir/include/mlir/IR/Location.h
M mlir/include/mlir/IR/Matchers.h
M mlir/include/mlir/IR/OpImplementation.h
M mlir/include/mlir/IR/Operation.h
M mlir/include/mlir/IR/Value.h
M mlir/lib/CAPI/IR/BuiltinAttributes.cpp
M mlir/lib/CAPI/IR/BuiltinTypes.cpp
M mlir/lib/CAPI/IR/IR.cpp
M mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp
M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
M mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
M mlir/lib/Dialect/Arith/IR/ValueBoundsOpInterfaceImpl.cpp
M mlir/lib/Dialect/ArmSVE/IR/ArmSVEDialect.cpp
M mlir/lib/Dialect/Async/IR/Async.cpp
M mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
M mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
M mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp
M mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp
M mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
M mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
M mlir/lib/Dialect/DLTI/DLTI.cpp
M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
M mlir/lib/Dialect/Func/IR/FuncOps.cpp
M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
M mlir/lib/Dialect/Index/IR/IndexOps.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMInterfaces.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
M mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
M mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
M mlir/lib/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.cpp
M mlir/lib/Dialect/MLProgram/IR/MLProgramDialect.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefMem2Reg.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/lib/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.cpp
M mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp
M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
M mlir/lib/Dialect/PDL/IR/PDL.cpp
M mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
M mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
M mlir/lib/Dialect/Quant/IR/QuantTypes.cpp
M mlir/lib/Dialect/Quant/IR/TypeParser.cpp
M mlir/lib/Dialect/SCF/IR/SCF.cpp
M mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVCanonicalization.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
M mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp
M mlir/lib/Dialect/Shape/IR/Shape.cpp
M mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
M mlir/lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp
M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
M mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
M mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
M mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
M mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
M mlir/lib/Dialect/Transform/IR/TransformOps.cpp
M mlir/lib/Dialect/Transform/IR/TransformTypes.cpp
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp
M mlir/lib/IR/AffineMap.cpp
M mlir/lib/IR/AsmPrinter.cpp
M mlir/lib/IR/AttributeDetail.h
M mlir/lib/IR/Attributes.cpp
M mlir/lib/IR/Builders.cpp
M mlir/lib/IR/BuiltinAttributeInterfaces.cpp
M mlir/lib/IR/BuiltinAttributes.cpp
M mlir/lib/IR/BuiltinDialect.cpp
M mlir/lib/IR/BuiltinDialectBytecode.cpp
M mlir/lib/IR/BuiltinTypes.cpp
M mlir/lib/IR/Diagnostics.cpp
M mlir/lib/IR/ExtensibleDialect.cpp
M mlir/lib/IR/FunctionImplementation.cpp
M mlir/lib/IR/FunctionInterfaces.cpp
M mlir/lib/IR/Location.cpp
M mlir/lib/IR/Operation.cpp
M mlir/lib/IR/OperationSupport.cpp
M mlir/lib/IR/SymbolTable.cpp
M mlir/lib/IR/TypeUtilities.cpp
M mlir/lib/IR/Verifier.cpp
M mlir/test/lib/Dialect/Test/TestAttributes.cpp
M mlir/test/lib/Dialect/Test/TestTypes.cpp
M mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
M mlir/test/python/lib/PythonTestCAPI.cpp
M mlir/unittests/TableGen/EnumsGenTest.cpp
Log Message:
-----------
[mlir] Update method cast calls to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.
Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.
Context:
* https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
* Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443
Implementation:
This follows a previous patch that updated calls
`op.cast<T>()-> cast<T>(op)`. However some cases could not handle an
unprefixed `cast` call due to occurrences of variables named cast, or
occurring inside of class definitions which would resolve to the method.
All C++ files that did not work automatically with `cast<T>()` are
updated here to `llvm::cast` and similar with the intention that they
can be easily updated after the methods are removed through a
find-replace.
See https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
for the clang-tidy check that is used and then update printed
occurrences of the function to include `llvm::` before.
One can then run the following:
```
ninja -C $BUILD_DIR clang-tidy
run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
-export-fixes /tmp/cast/casts.yaml mlir/*\
-header-filter=mlir/ -fix
rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```
Differential Revision: https://reviews.llvm.org/D150348
Compare: https://github.com/llvm/llvm-project/compare/c89266448666...c1fa60b4cde5
More information about the All-commits
mailing list