[all-commits] [llvm/llvm-project] 7253c6: [InstCombine] Transform high latency, dependent FS...

Sushant Gokhale via All-commits all-commits at lists.llvm.org
Thu Jan 16 21:09:36 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7253c6fde498c4c9470b681df47d46e6930d6a02
      https://github.com/llvm/llvm-project/commit/7253c6fde498c4c9470b681df47d46e6930d6a02
  Author: Sushant Gokhale <sgokhale at nvidia.com>
  Date:   2025-01-16 (Thu, 16 Jan 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    A llvm/test/Transforms/InstCombine/fsqrtdiv-transform.ll

  Log Message:
  -----------
  [InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL (#87474)

The proposed patch, in general, tries to transform the below code
sequence:
x = 1.0 / sqrt (a);
r1 = x * x;  // same as 1.0 / a
r2 = a / sqrt(a); // same as sqrt (a)

TO

(If x, r1 and r2 are all used further in the code) 
r1 = 1.0 / a
r2 = sqrt (a)
x = r1 * r2

The transform tries to make high latency sqrt and div operations
independent and also saves on one multiplication.

The patch was tested with SPEC17 suite with cpu=neoverse-v2. The
performance uplift achieved was:
544.nab_r   ~4%

No other regressions were observed. Also, no compile time differences
were observed with the patch.

Closes #54652



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list