[PATCH] D140647: Handle simple diamond CFG hoisting in DivRemPairs.

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 24 10:56:30 PST 2022


barannikov88 added a comment.

> Div/rem are usually *extremely* slow, so that code was in a bad spot already.

And we're going to make it twice as bad by hoisting the Div that might not be executed at all in the original case.
I.e. in the original case we execute either div or rem, but //not both//. After the transformation we execute div unconditionally, and //additionally// mul+sub in one of the cases.

I could agree that the latency issue may prevail in the case when rem is guaranteed to be expanded into div+mul+sub (and not into a libcall, for example).
Otherwise we're only going to increase the latency on the rem path.
However, this case should already be handled by MachineCSE, which has more context information such as register pressure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140647



More information about the llvm-commits mailing list