[llvm] [LibCallShrinkWrap] Added ilogb in performCallErrors() (PR #122582)

Vedant Paranjape via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 02:56:50 PST 2025


VedantParanjape wrote:

> And I am suspicious of the original code, which states that the error in calling `ilogb` is the same as `log`. However, according to the man pages, this is not true.
> 
> `ilogb`:
> 
> ```
> ERRORS         [top](https://man7.org/linux/man-pages/man3/ilogb.3.html#top_of_page)
>        See [math_error(7)](https://man7.org/linux/man-pages/man7/math_error.7.html) for information on how to determine whether an
>        error has occurred when calling these functions.
> 
>        The following errors can occur:
> 
>        Domain error: x is 0 or a NaN
>               An invalid floating-point exception (FE_INVALID) is
>               raised, and [errno](https://man7.org/linux/man-pages/man3/errno.3.html) is set to EDOM (but see BUGS).
> 
>        Domain error: x is an infinity
>               An invalid floating-point exception (FE_INVALID) is
>               raised, and [errno](https://man7.org/linux/man-pages/man3/errno.3.html) is set to EDOM (but see BUGS).
> ```
> 
> `log`:
> 
> ```
> See [math_error(7)](https://man7.org/linux/man-pages/man7/math_error.7.html) for information on how to determine whether an
>        error has occurred when calling these functions.
> 
>        The following errors can occur:
> 
>        Domain error: x is negative
>               [errno](https://man7.org/linux/man-pages/man3/errno.3.html) is set to EDOM.  An invalid floating-point exception
>               (FE_INVALID) is raised.
> 
>        Pole error: x is zero
>               [errno](https://man7.org/linux/man-pages/man3/errno.3.html) is set to ERANGE.  A divide-by-zero floating-point
>               exception (FE_DIVBYZERO) is raised.
> ```

looking at isMathLibCallNoop, I think we need checks in there as well as LibCallShrinkWrap. Since there are three Domain errors to be covered, right?

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


More information about the llvm-commits mailing list