[all-commits] [llvm/llvm-project] 7c49f3: [InstCombine][SimplifyLibCalls] An extra sqrtf was...

Daniil Seredkin via All-commits all-commits at lists.llvm.org
Wed Mar 10 09:33:31 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c49f3c75be95401b089cab75bb71a71020b350d
      https://github.com/llvm/llvm-project/commit/7c49f3c75be95401b089cab75bb71a71020b350d
  Author: Daniil Seredkin <vdsered at gmail.com>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

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

  Log Message:
  -----------
  [InstCombine][SimplifyLibCalls] An extra sqrtf was produced because of transformations in optimizePow function

See: https://bugs.llvm.org/show_bug.cgi?id=47613

There was an extra sqrt call because shrinking emitted a new powf and at the same time optimizePow replaces the previous pow with sqrt and as the result we have two instructions that will be in worklist of InstCombie despite the fact that %powf is not used by anyone (it is alive because of errno).

As the result we have two instructions:

  %powf = call fast float @powf(float %x, float 5.000000e-01)
  %sqrt = call fast double @sqrt(double %dx)

%powf will be converted to %sqrtf on a later iteration.

As a quick fix for that I moved shrinking to the end of optimizePow so that pow is replaced with sqrt at first that allows not to emit a new shrunk powf.

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




More information about the All-commits mailing list