[PATCH] D128123: [SDAG] try to replace subtract-from-constant with xor

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 13:37:05 PDT 2022


bjope added a comment.

In D128123#3645270 <https://reviews.llvm.org/D128123#3645270>, @spatel wrote:

> In D128123#3643672 <https://reviews.llvm.org/D128123#3643672>, @bjope wrote:
>
>> Not sure really if this ends up as a regression or not, but with this source we can see some differences if for example using heaxagon or systemz as targets.
>> (This example is related to doing sub->xor in instcombine so not exactly the patch in this review.)
>
> Thanks for the example. The instcombine variation of this fold has a different problem that I noticed in another example.
> Can you try the patch below and see if that fixes the regressions for your target?

I rerun some benchmarks with that patch and the cycle counts were restored in those tests that earlier showed a regression. So that is great.
Still a small fear that xor is harder for us to lower into machine IR compared to sub (considering register constraints etc). But I guess that is something we should deal with downstream somehow (investigate if we can select xor as a sub when possible).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128123



More information about the llvm-commits mailing list