[PATCH] D104247: [DAGCombine] reassoc flag shouldn't enable contract

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 08:15:59 PDT 2021


jsji added a comment.

In D104247#2827089 <https://reviews.llvm.org/D104247#2827089>, @spatel wrote:

> In code that I've looked at (mostly C compiled with -ffast-math), we always have `contract` when we have `reassoc`, so I don't see much practical difference.
> Can you explain more how we could benefit from this change - in the example in the description, we would have 4 instructions rather than 3 if we use FMA - is that better?

Yes, you are right, the performance of having FMA should be better. However, we have quite some scenarios that users care about precision more than performance, they want to precise control of when FMA can be generated. So The major motivation of this is to ensure that we respect the IR semantics. For users that care about performance, we still can get them through default global option or emitting respect flag in IR.

> We should duplicate (instead of edit) at least a few of the tests, so we can verify that the existing tests do not form FMA now. That could also be used to show an advantage from not forming FMA.

Sure, I can do that . Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104247



More information about the llvm-commits mailing list