[InstCombine] Z / (1.0 / Y) => (Y * Z)
author@raghesh (Raghesh Aloor) <raghesh.a@gmail.com>
Thu, 9 Jan 2020 15:52:39 +0000 (10:52 -0500)
committerSanjay Patel <spatel@rotateright.com>
Thu, 9 Jan 2020 15:52:39 +0000 (10:52 -0500)
commit6c04ef472a8739a60a7935f77edfbacd2f50eb73
tree535979b6af34ab81a13e97d292ee1c9fbafa9876
parent0fa8f701ccf6f29544394b358f38b748e3f7ab24
[InstCombine] Z / (1.0 / Y) => (Y * Z)

This is a special case of Z / (X / Y) => (Y * Z) / X, with X = 1.0.
The m_OneUse check is avoided because even in the case of the
multiple uses for 1.0/Y, the number of instructions remain the same
and a division is replaced by a multiplication.

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