[InstCombine] fold fdiv with pow divisor (PR49147)
authorSanjay Patel <spatel@rotateright.com>
Sun, 14 Feb 2021 13:06:15 +0000 (08:06 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 14 Feb 2021 13:07:36 +0000 (08:07 -0500)
commitb40fde062c306584d88243de11175187e754ce3b
tree7efa6faf297fae0cdbb71e5271b2c859d9c630dc
parent2c5c7d5feb7e57f533f0ba3d96785b5e14b94ba0
[InstCombine] fold fdiv with pow divisor (PR49147)

This is unusual in the general (non-reciprocal) case because we need
an extra instruction, but that should be better for general FP
reassociation and codegen. We conservatively check for "arcp" FMF
here as we do with existing fdiv folds, but it is not strictly
necessary to have that.

This is part of solving:
https://llvm.org/PR49147
(The powi variant potentially has a different constraint.)

Differential Revision: https://reviews.llvm.org/D96648
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/fdiv.ll