llvm-project
b2b433bb - [DAGCombiner] Rebuild FMA chain instead of mutating it in place (#241188)

Commit
22 days ago
[DAGCombiner] Rebuild FMA chain instead of mutating it in place (#241188) visitFADDForFMACombine folds fadd (fma A, B, (fmul C, D)), E --> fma A, B, (fma C, D, E) by replacing the inner fmul in place with ReplaceAllUsesOfValueWith. If fma A, B, (fma C, D, E) already exists, e.g. when another expression adds the same terms in a different order, CSE merges the updated chain into it and the outer fadd becomes fadd (fma A, B, (fma C, D, E)), E The combine returns this outer fadd, retaining the extra addition of E. If an identical fadd already exists, the outer fadd is CSE'd away while being visited. Rebuild the chain with getNode instead, and drop the DELETED_NODE check in visitFADD.
Author
Parents
Loading