[Mlir-commits] [mlir] 21133f1 - [TOSA] Fix -Wdangling-gsl and -Wunused-variable in TosaToLinalg.cpp (NFC)

Jie Fu llvmlistbot at llvm.org
Thu Jan 11 06:42:10 PST 2024


Author: Jie Fu
Date: 2024-01-11T22:41:17+08:00
New Revision: 21133f1da4cde22b63c5f62df25d97e51a3cf4ea

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

LOG: [TOSA] Fix -Wdangling-gsl and -Wunused-variable in TosaToLinalg.cpp (NFC)

llvm-project/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp:2376:9:
 error: object backing the pointer will be destroyed at the end of the full-expression [-Werror,-Wdangling-gsl]
        tensor::getMixedSizes(rewriter, loc, input_real);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm-project/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp:2366:10:
 error: unused variable 'imag_el_ty' [-Werror,-Wunused-variable]
    auto imag_el_ty = cast<FloatType>(
         ^
2 errors generated.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
index 1e94dfd7feb94e..647592395c8760 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
@@ -2363,7 +2363,7 @@ struct FFT2dConverter final : OpRewritePattern<FFT2dOp> {
 
     auto real_el_ty = cast<FloatType>(
         cast<ShapedType>(input_real.getType()).getElementType());
-    auto imag_el_ty = cast<FloatType>(
+    [[maybe_unused]] auto imag_el_ty = cast<FloatType>(
         cast<ShapedType>(input_imag.getType()).getElementType());
 
     assert(real_el_ty == imag_el_ty);
@@ -2372,8 +2372,7 @@ struct FFT2dConverter final : OpRewritePattern<FFT2dOp> {
     SmallVector<Value> dynamicSizes;
 
     // Get [N, H, W]
-    ArrayRef<OpFoldResult> dims =
-        tensor::getMixedSizes(rewriter, loc, input_real);
+    auto dims = tensor::getMixedSizes(rewriter, loc, input_real);
 
     SmallVector<int64_t, 3> staticSizes;
     dispatchIndexOpFoldResults(dims, dynamicSizes, staticSizes);


        


More information about the Mlir-commits mailing list