diff --git a/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp b/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp --- a/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp +++ b/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp @@ -87,7 +87,7 @@ /// Directly lower to LLVM op. struct ConstantOpLowering : public ConvertOpToLLVMPattern { - using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(arith::ConstantOp op, OpAdaptor adaptor, @@ -99,7 +99,7 @@ /// types is the same, just erase the cast. If the target type is wider, /// sign-extend the value, otherwise truncate it. struct IndexCastOpLowering : public ConvertOpToLLVMPattern { - using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(arith::IndexCastOp op, OpAdaptor adaptor, @@ -107,7 +107,7 @@ }; struct CmpIOpLowering : public ConvertOpToLLVMPattern { - using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(arith::CmpIOp op, OpAdaptor adaptor, @@ -115,7 +115,7 @@ }; struct CmpFOpLowering : public ConvertOpToLLVMPattern { - using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(arith::CmpFOp op, OpAdaptor adaptor, @@ -143,10 +143,10 @@ LogicalResult IndexCastOpLowering::matchAndRewrite( arith::IndexCastOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const { - auto resultType = op.getResult().getType(); - auto targetElementType = + Type resultType = op.getResult().getType(); + Type targetElementType = typeConverter->convertType(getElementTypeOrSelf(resultType)); - auto sourceElementType = + Type sourceElementType = typeConverter->convertType(getElementTypeOrSelf(op.getIn())); unsigned targetBits = targetElementType.getIntOrFloatBitWidth(); unsigned sourceBits = sourceElementType.getIntOrFloatBitWidth(); @@ -157,9 +157,9 @@ } // Handle the scalar and 1D vector cases. - auto operandType = adaptor.getIn().getType(); + Type operandType = adaptor.getIn().getType(); if (!operandType.isa()) { - auto targetType = typeConverter->convertType(resultType); + Type targetType = typeConverter->convertType(resultType); if (targetBits < sourceBits) rewriter.replaceOpWithNewOp(op, targetType, adaptor.getIn()); @@ -169,8 +169,7 @@ return success(); } - auto vectorType = resultType.dyn_cast(); - if (!vectorType) + if (!resultType.isa()) return rewriter.notifyMatchFailure(op, "expected vector result type"); return LLVM::detail::handleMultidimensionalVectors( @@ -201,8 +200,8 @@ LogicalResult CmpIOpLowering::matchAndRewrite(arith::CmpIOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const { - auto operandType = adaptor.getLhs().getType(); - auto resultType = op.getResult().getType(); + Type operandType = adaptor.getLhs().getType(); + Type resultType = op.getResult().getType(); // Handle the scalar and 1D vector cases. if (!operandType.isa()) { @@ -213,8 +212,7 @@ return success(); } - auto vectorType = resultType.dyn_cast(); - if (!vectorType) + if (!resultType.isa()) return rewriter.notifyMatchFailure(op, "expected vector result type"); return LLVM::detail::handleMultidimensionalVectors( @@ -236,8 +234,8 @@ LogicalResult CmpFOpLowering::matchAndRewrite(arith::CmpFOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const { - auto operandType = adaptor.getLhs().getType(); - auto resultType = op.getResult().getType(); + Type operandType = adaptor.getLhs().getType(); + Type resultType = op.getResult().getType(); // Handle the scalar and 1D vector cases. if (!operandType.isa()) { @@ -248,8 +246,7 @@ return success(); } - auto vectorType = resultType.dyn_cast(); - if (!vectorType) + if (!resultType.isa()) return rewriter.notifyMatchFailure(op, "expected vector result type"); return LLVM::detail::handleMultidimensionalVectors(