[PATCH] D79409: [InstCombine] Remove hasNoInfs check for pow(C, y) -> exp2(log2(C)*y)

Evandro Menezes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 17:04:23 PDT 2020


evandro added a comment.

In D79409#2023674 <https://reviews.llvm.org/D79409#2023674>, @foad wrote:

> No, the sign of log2(x) depends on whether x is less or greater than 1, not less or greater than 2.


You're right.

`pow(x, -∞)` → ∞ if `x < 1` or 0 if `x > 1`
`pow(x, +∞)` → 0 if `x < 1` or ∞ if `x > 1`

`exp2(log2(x) * -∞)` → `exp2(±∞)` → ∞ if `x < 1` or 0 if `x > 1`
`exp2(log2(x) * +∞)` → `exp2(±∞)` → 0 if `x < 1` or ∞ if `x > 1`

Therefore the identity holds.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79409/new/

https://reviews.llvm.org/D79409





More information about the llvm-commits mailing list