[PATCH] Reassociate x + -0.1234 * y into x - 0.1234 * y
Chad Rosier
mcrosier at codeaurora.org
Tue Aug 19 08:40:25 PDT 2014
LGTM. Let me know if you need me to push the commit.
Chad
================
Comment at: lib/Transforms/Scalar/Reassociate.cpp:1986
@@ +1985,3 @@
+ // Transform:
+ // FAdd(x, FMul(-0.1234, y)) -> FSub(x, FMul(0.1234, y))
+ // where the FMul can also be an FDiv, and FAdd can be a FSub.
----------------
We can be more generic here:
FAdd(x, FMul(-ConstantFP, y)) -> FSub(x, FMul(ConstantFP, y))
I actually prefer
// Reassociate: x + -ConstantFP * y -> x - ConstantFP * y
but I'll let you decide.
http://reviews.llvm.org/D4904
More information about the llvm-commits
mailing list