Files
clang-p2996/mlir/test/Dialect/Quant
Sandeep Dasgupta 90a5744beb Remove redundant checks related to quantized type (#110604)
[APFloat::getSmallest](915df1ae41/llvm/include/llvm/ADT/APFloat.h (L1060))
(and similarly `APFloat:getLargest`)
```
APFloat getSmallest(const fltSemantics &Sem, bool Negative = false); 
```
return the positive number when the default value for the second
argument is used.

With that being said, the check
[QuantTypes.cpp#L325](96f37ae453/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp (L325))

```c++
 if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale))
    return emitError() << "illegal scale: " << scale;
```  

is already covered by the check which follows
[QuantTypes.cpp#L327](96f37ae453/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp (L327))

```c++
  if (scale < minScale || scale > maxScale)
    return emitError() << "scale out of expressed type range [" << minScale
                       << ", " << maxScale << "]";
```

given that range `[positive-smallest-finite-number,
positive-largest-finite-number]` does not include `inf` and `nan`s.

I propose to remove the redundant check. Any suggestion for improving
the error message is welcome.
2024-10-07 15:16:29 -04:00
..