diff --git a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp --- a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp +++ b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp @@ -74,8 +74,8 @@ [&](Type llvm1DVectorTy, ValueRange operands) { LLVM::ConstantOp zero = rewriter.create(loc, boolType, boolZero); - return rewriter.replaceOpWithNewOp(op, llvm1DVectorTy, - operands[0], zero); + return rewriter.create(loc, llvm1DVectorTy, operands[0], + zero); }, rewriter); } diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -259,6 +259,8 @@ // tosa::ClzOp if (isa(op) && elementTy.isa()) { + return rewriter.create(loc, elementTy, args[0]); + /* int bitWidth = elementTy.getIntOrFloatBitWidth(); auto zero = rewriter.create(loc, IntegerAttr::get(elementTy, 0)); @@ -307,6 +309,7 @@ rewriter.setInsertionPointAfter(whileOp); return whileOp->getResult(1); + */ } // tosa::LogicalAnd diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir --- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir +++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir @@ -366,12 +366,7 @@ // CHECK: arith.addi %12 = "tosa.arithmetic_right_shift"(%arg0, %arg0) {round = 1 : i1} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> - // CHECK: scf.while - // CHECK: arith.cmpi ne - // CHECK: scf.condition - // CHECK: arith.shrui - // CHECK: arith.subi - // CHECK: scf.yield + // CHECK: math.ctlz %13 = "tosa.clz"(%arg0) : (tensor<1xi32>) -> tensor<1xi32> // CHECK: linalg.generic