[llvm] [ConstantFold] Fold `ilogb` and `ilogbf` when the input parameter is a constant value. (PR #113014)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 07:30:47 PDT 2024


c8ef wrote:

> LGTM but please consider cleaning up this function. There should be a switch over intrinsic IDs.

But for libcall like `ilogb`, which does not have corresponding intrinsic, its intrinsic ID is 0, so we may still need to switch over Name for them.

> The repeated TLI->has(func) in each case could be done once for all the libcall cases.
> 
> It would also be good to avoid explicitly listing the edge cases in the pre-check of the ConstantFoldFP call

This could be partially achieved by the solution proposed in https://github.com/llvm/llvm-project/pull/112113#discussion_r1800292189.


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


More information about the llvm-commits mailing list