[all-commits] [llvm/llvm-project] 7736c1: [InstCombine] Missed optimization for pow(x, y) * ...
vdsered via All-commits
all-commits at lists.llvm.org
Mon Jun 7 05:10:48 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7736c1936a93d7effecf32ef5193dfc00b732cd2
https://github.com/llvm/llvm-project/commit/7736c1936a93d7effecf32ef5193dfc00b732cd2
Author: Daniil Seredkin <vdsered at gmail.com>
Date: 2021-06-07 (Mon, 07 Jun 2021)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
M llvm/test/Transforms/InstCombine/fmul-pow.ll
Log Message:
-----------
[InstCombine] Missed optimization for pow(x, y) * pow(x, z) with fast-math
If FP reassociation (fast-math) is allowed, then LLVM is free to do the
following transformation pow(x, y) * pow(x, z) -> pow(x, y + z).
This patch adds this transformation and tests for it.
See more https://bugs.llvm.org/show_bug.cgi?id=47205
It handles two cases
1. When operands of fmul are different instructions
%4 = call reassoc float @llvm.pow.f32(float %0, float %1)
%5 = call reassoc float @llvm.pow.f32(float %0, float %2)
%6 = fmul reassoc float %5, %4
-->
%3 = fadd reassoc float %1, %2
%4 = call reassoc float @llvm.pow.f32(float %0, float %3)
2. When operands of fmul are the same instruction
%4 = call reassoc float @llvm.pow.f32(float %0, float %1)
%5 = fmul reassoc float %4, %4
-->
%3 = fadd reassoc float %1, %1
%4 = call reassoc float @llvm.pow.f32(float %0, float %3)
Differential Revision: https://reviews.llvm.org/D102574
More information about the All-commits
mailing list