[llvm] [RISCV] Only calculate ordered reduction with FloatingPoint type. NFC (PR #114180)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 07:46:01 PDT 2024


ElvisWang123 wrote:

> What is the point of this change? Only floating point reductions should return true for requiresOrderedReduction?

Without the check  querying  the `getArithmeticReductionCost()` by `reduce.add` `reduce.and` ... integer  reductions  without  `reassoc` flag will fall into it. And it will return the cost of the floating point ordered reduction.

I found this issue in the #114184. When we query the cost model and always pass the FMF flags from the IntrinsicCostAttributes, it always return the cost of FP ordered reduction.

I thought it  is more user friendly to check if it is floating point type and user can call `getArithmeticReductionCost()` without   dropping `FMF` flags when it is integer type.

https://github.com/llvm/llvm-project/pull/114180


More information about the llvm-commits mailing list