[PATCH] D80801: [DAGCombiner] allow more folding of fadd + fmul into fma
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 06:55:54 PDT 2020
spatel marked an inline comment as done.
spatel added subscribers: shchenz, nemanjai.
spatel added inline comments.
Herald added a subscriber: wuzish.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11831
+ // fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))
+ if (CanFuse &&
+ N0.getOpcode() == PreferredFusedOpcode &&
----------------
lebedev.ri wrote:
> We only care if the root node `N` allows producing FMA, we don't care about leafs?
Yes, this is the usual FMF constraint: if the final/root value has the necessary flags, we assume that intermediate calculations leading to that value can be relaxed using those flags as well. And that's carried over in the propagation of FMF when creating the new nodes as well. (cc @nemanjai @shchenz @steven.zhang who may be looking at related changes).
I think we have seen some cases where that might be too liberal of an interpretation of FMF, but as you noticed, I didn't change any of the code here (including typos) because I only wanted to adjust the aggressive TLI constraint in this patch.
In practice, all of the FP nodes will have the same flags unless we have mixed FP-optimized compilation with LTO + inlining or something similar to that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80801/new/
https://reviews.llvm.org/D80801
More information about the llvm-commits
mailing list