[Mlir-commits] [mlir] [mlir][tosa] Support boolean types for clamp folder (PR #151653)

Longsheng Mou llvmlistbot at llvm.org
Fri Aug 1 03:31:46 PDT 2025


================
@@ -498,12 +495,9 @@ struct ClampIsNoOp : public OpRewritePattern<tosa::ClampOp> {
       int64_t maxClamp =
           llvm::cast<mlir::IntegerAttr>(op.getMaxValAttr()).getInt();
 
-      int64_t intMin =
-          APInt::getSignedMinValue(inputElementType.getIntOrFloatBitWidth())
-              .getSExtValue();
-      int64_t intMax =
-          APInt::getSignedMaxValue(inputElementType.getIntOrFloatBitWidth())
-              .getSExtValue();
+      unsigned bitWidth = inputElementType.getIntOrFloatBitWidth();
+      int64_t intMin = APInt::getSignedMinValue(bitWidth).getSExtValue();
+      int64_t intMax = APInt::getSignedMaxValue(bitWidth).getSExtValue();
----------------
CoTinker wrote:

Okay.

https://github.com/llvm/llvm-project/pull/151653


More information about the Mlir-commits mailing list