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

Matt D. via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 15:28:17 PDT 2023


Matt added a comment.

Thanks!

This explains some of the behavior I've observed.
Context: Downstream implementation with a custom floating-point trapping behavior which generally disables constant folding for would-be trapping operations (such as mutiplying 1e-30f * 1e-30f which would result FE_UNDERFLOW due to underflow to zero).

The issue I've observed is exactly like in https://github.com/llvm/llvm-project/issues/61224, i.e., an infinite loop.
I suppose this is due to the fact that FMul (as in the example above) is not constant folded.

I think I may be able to deal with this downstream if I can prevent the constant folding alone while not regressing back to the infinite loop as in issue 61224 (I suppose that run into the infinite loop as the pass at this point didn't expect non-constant-folded instructions?).
As a workaround I may be able to disable AllowHorRdxIdenityOptimization whenever the custom trapping is enabled.
For my context, I'm wondering, would you happen to know whether disabling the constant-folding alone without running into an infinite loop issue is even possible?

I've noticed there are 4 occurrences of AllowHorRdxIdenityOptimization and I can try to experiment selective disablement (I presume the `allConstant` branches are mostly relevant here) but thought I'd ask just in case this is a general issue.


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