[PATCH] D32596: [DAGCombine] Transform (fadd A, (fmul B, -2.0)) -> (fsub A, (fadd B, B)).

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 11:09:50 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D32596#746288, @mcrosier wrote:

> While InstCombine does nothing, the reassociation pass will canonicalize to
>
>   (fsub A, (fmul/fdiv B, -C)) -> (fadd A, (fmul/fdiv B, C))
>   (fadd A, (fmul/fdiv B, -C)) -> (fsub A, (fmul/fdiv B, C))


Thanks for checking those out. I haven't looked at the reassociation pass very much. I'm surprised to see it flip a constant's sign and create an fsub rather than fadd. Any ideas why that is a good thing to do?


Repository:
  rL LLVM

https://reviews.llvm.org/D32596





More information about the llvm-commits mailing list