diff options
author | Sandeep Dasgupta <sdasgup@google.com> | 2024-10-07 19:16:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 15:16:29 -0400 |
commit | 90a5744bebffafb88abf2343a1a70a37e12abef4 (patch) | |
tree | 2227eb255cbc1e718c348dec3553b50697d267d5 /llvm/lib/IR/Verifier.cpp | |
parent | 3f5039323c43af22896aeb2c34f6b302768d1fab (diff) | |
download | llvm-90a5744bebffafb88abf2343a1a70a37e12abef4.zip llvm-90a5744bebffafb88abf2343a1a70a37e12abef4.tar.gz llvm-90a5744bebffafb88abf2343a1a70a37e12abef4.tar.bz2 |
Remove redundant checks related to quantized type (#110604)
[APFloat::getSmallest](https://github.com/llvm/llvm-project/blob/915df1ae41652e2f595ce741dcd8f01878ef4e30/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](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/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](https://github.com/llvm/llvm-project/blob/96f37ae45310885e09195be09d9c05e1c1dff86b/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.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
0 files changed, 0 insertions, 0 deletions