[Mlir-commits] [mlir] af339f8 - Remove redundant casts.

Adrian Kuegel llvmlistbot at llvm.org
Sun Jan 10 23:52:18 PST 2021


Author: Adrian Kuegel
Date: 2021-01-11T08:51:47+01:00
New Revision: af339f89a142622b6fc56c5f79d19e568af5287a

URL: https://github.com/llvm/llvm-project/commit/af339f89a142622b6fc56c5f79d19e568af5287a
DIFF: https://github.com/llvm/llvm-project/commit/af339f89a142622b6fc56c5f79d19e568af5287a.diff

LOG: Remove redundant casts.

Differential Revision: https://reviews.llvm.org/D94305

Added: 
    

Modified: 
    mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 8023a8009758..53ebd6721863 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -1735,19 +1735,18 @@ struct CreateComplexOpLowering
   using ConvertOpToLLVMPattern<CreateComplexOp>::ConvertOpToLLVMPattern;
 
   LogicalResult
-  matchAndRewrite(CreateComplexOp op, ArrayRef<Value> operands,
+  matchAndRewrite(CreateComplexOp complexOp, ArrayRef<Value> operands,
                   ConversionPatternRewriter &rewriter) const override {
-    auto complexOp = cast<CreateComplexOp>(op);
     CreateComplexOp::Adaptor transformed(operands);
 
     // Pack real and imaginary part in a complex number struct.
-    auto loc = op.getLoc();
+    auto loc = complexOp.getLoc();
     auto structType = typeConverter->convertType(complexOp.getType());
     auto complexStruct = ComplexStructBuilder::undef(rewriter, loc, structType);
     complexStruct.setReal(rewriter, loc, transformed.real());
     complexStruct.setImaginary(rewriter, loc, transformed.imaginary());
 
-    rewriter.replaceOp(op, {complexStruct});
+    rewriter.replaceOp(complexOp, {complexStruct});
     return success();
   }
 };
@@ -1794,8 +1793,7 @@ template <typename OpTy>
 BinaryComplexOperands
 unpackBinaryComplexOperands(OpTy op, ArrayRef<Value> operands,
                             ConversionPatternRewriter &rewriter) {
-  auto bop = cast<OpTy>(op);
-  auto loc = bop.getLoc();
+  auto loc = op.getLoc();
   typename OpTy::Adaptor transformed(operands);
 
   // Extract real and imaginary values from operands.


        


More information about the Mlir-commits mailing list