]> granicus.if.org Git - llvm/commit
[InstCombine] remove flop from lerp patterns
authorSanjay Patel <spatel@rotateright.com>
Fri, 26 Jul 2019 11:19:18 +0000 (11:19 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 26 Jul 2019 11:19:18 +0000 (11:19 +0000)
commit3798c1bc58fad67298e3a0033c0b8c8ea3aa9d26
treef95730a056d52db141765e8f22ed5f30fd1a5a5f
parentc6b70f7dc3cbb96d77c835ad4108a8c34b88ee5a
[InstCombine] remove flop from lerp patterns

(Y * (1.0 - Z)) + (X * Z) -->
Y - (Y * Z) + (X * Z) -->
Y + Z * (X - Y)

This is part of solving:
https://bugs.llvm.org/show_bug.cgi?id=42716

Factoring eliminates an instruction, so that should be a good canonicalization.
The potential conversion to FMA would be handled by the backend based on target
capabilities.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367101 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/fadd-fsub-factor.ll