[PATCH] D132261: [SLP]Do not reduce repeated values, use scalar red ops instead.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 15:16:55 PDT 2023


ABataev added a comment.

In D132261#4317008 <https://reviews.llvm.org/D132261#4317008>, @Matt wrote:

> @ABataev  May I ask whether the change to constant folding semantics is intended with `-slp-optimize-identity-hor-reduction-ops`?
>
> Cf. https://godbolt.org/z/G44xhKcTc
>
> I wonder whether this may be connected to the constant folding similar to `createOp` related to this patch, https://github.com/llvm/llvm-project/issues/61224, https://github.com/llvm/llvm-project/commit/c411965820eb803dd7eac39f80357cad663b7ba0
>
> - LLVM version 16.0.0
>
> `opt -passes=slp-vectorizer`
>
>   %mul = fmul reassoc nsz float 0x39B4484C00000000, 0x39B4484C00000000
>   ret float %mul
>
>
>
> - LLVM version 17.0.0git
>
> `opt -passes=slp-vectorizer -slp-optimize-identity-hor-reduction-ops=0`
>
>   %mul = fmul reassoc nsz float 0x39B4484C00000000, 0x39B4484C00000000
>   ret float %mul
>
>
>
> - LLVM version 17.0.0git
>
> `opt -passes=slp-vectorizer`
>
>   ret float 0.000000e+00

Yes, slp-vectorizer may fold constants as a side effect of the reduction optimization.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132261/new/

https://reviews.llvm.org/D132261



More information about the llvm-commits mailing list