[InstCombine] fold reassociative FP add into start value of fadd reduction
authorSanjay Patel <spatel@rotateright.com>
Sat, 17 Jul 2021 22:36:36 +0000 (18:36 -0400)
committerSanjay Patel <spatel@rotateright.com>
Sun, 18 Jul 2021 10:26:20 +0000 (06:26 -0400)
commit0e15de2d0c6976acecb25b90e1e27b278404b0cf
tree0b60478ecb39881567468831777dabd1836187d0
parent059050226532d633199f33c5df19b7e9eeccbf22
[InstCombine] fold reassociative FP add into start value of fadd reduction

This pattern is visible in unrolled and vectorized loops.
Although the backend seems to be able to reassociate to
ideal form in the examples I looked at, we might as well
do that in IR for efficiency.
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/fadd.ll
llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll