[all-commits] [llvm/llvm-project] b17754: [SimplifyLibCalls] refactor pow(x, n) expansion wh...

pawosm-arm via All-commits all-commits at lists.llvm.org
Sat Jul 9 09:01:59 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b17754bcaa1437bc9f2c716e59cc1c933fd77891
      https://github.com/llvm/llvm-project/commit/b17754bcaa1437bc9f2c716e59cc1c933fd77891
  Author: Paul Osmialowski <pawel.osmialowski at arm.com>
  Date:   2022-07-09 (Sat, 09 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    A llvm/test/CodeGen/AArch64/powi.ll
    M llvm/test/Transforms/InstCombine/pow-4.ll
    M llvm/test/Transforms/InstCombine/pow_fp_int.ll
    M llvm/test/Transforms/InstCombine/pow_fp_int16.ll

  Log Message:
  -----------
  [SimplifyLibCalls] refactor pow(x, n) expansion where n is a constant integer value

Since the backend's codegen is capable to expand powi into fmul's, it
is not needed anymore to do so in the ::optimizePow() function of
SimplifyLibCalls.cpp. What is sufficient is to always turn pow(x, n)
into powi(x, n) for the cases where n is a constant integer value.

Dropping the current expansion code allowed relaxation of the folding
conditions and now this can also happen at optimization levels below
Ofast.

The added CodeGen/AArch64/powi.ll test case ensures that powi is
actually expanded into fmul's, confirming that this refactor did not
cause any performance degradation.

Following an idea proposed by David Sherwood <david.sherwood at arm.com>.

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




More information about the All-commits mailing list