[PATCH] Refactor and enhance FMA combine

Fiona Glaser fglaser at apple.com
Thu Apr 2 12:55:31 PDT 2015


> On Apr 2, 2015, at 12:41 PM, Olivier Sallenave <ohsallen at us.ibm.com> wrote:
> 
> Hi Mehdi,
> 
>> I’d rather see the duplicated code (the one made obsolete by a correct canonicalization) removed from your patch (i.e. do not build technical debt), and a separate commits that implement the canonicalization part.
> 
> 
> Makes perfect sense, thanks for your feedback. I was able to do the canonicalization you suggest by adding the following transforms:
> 
> (fsub (fneg A), B) -> (fneg (fadd A, B))
> (fpext (fneg x)) -> (fneg (fpext x)

This second transform makes me nervous; I recently implemented the exact opposite transform in an out-of-tree backend, specifically fold (fneg (fpext x)) to (fpext (fneg x)) if the first fneg cannot be folded down as a modifier and the fpext hasOneUse. This matters if the user of the fneg cannot fold in the fneg, but can fold in the fpext, while the subject of the fpext can fold in a negate. I suspect other GPU backends like R600 won’t like it either.

Fiona



More information about the llvm-commits mailing list