[all-commits] [llvm/llvm-project] 9bc989: [InstCombine] Remove hasNoInfs check for pow(C, y) ...

jayfoad via All-commits all-commits at lists.llvm.org
Tue May 19 09:06:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bc989a48d639d04283d6144505e33e8e354c783
      https://github.com/llvm/llvm-project/commit/9bc989a48d639d04283d6144505e33e8e354c783
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2020-05-19 (Tue, 19 May 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InstCombine/pow-exp.ll

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

We already check hasNoNaNs and that x is finite and strictly positive.
That only leaves the following special cases (taken from the Linux man
page for pow):

If x is +1, the result is 1.0 (even if y is a NaN).
If the absolute value of x is less than 1, and y is negative infinity, the result is positive infinity.
If the absolute value of x is greater than 1, and y is negative infinity, the result is +0.
If the absolute value of x is less than 1, and y is positive infinity, the result is +0.
If the absolute value of x is greater than 1, and y is positive infinity, the result is positive infinity.

The first case is handled elsewhere, and this transformation preserves
all the others, so there is no need to limit it to hasNoInfs.

Differential Revision: https://reviews.llvm.org/D79409




More information about the All-commits mailing list