[PATCH] D26149: [DAGCombiner] Match load by bytes idiom and fold it into a single load

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 08:45:12 PST 2021


reames added a comment.

In D26149#3131756 <https://reviews.llvm.org/D26149#3131756>, @spatel wrote:

> In D26149#3130357 <https://reviews.llvm.org/D26149#3130357>, @Joshua-401 wrote:
>
>> Did you consider doing the load combine at IR level? I'm now trying to combine loads at IR level during the InstCombine process, so I'm wondering why you didn't do that.
>
> There was an IR load combine pass (see D3580 <https://reviews.llvm.org/D3580> - although never enabled by default AFAIK), but it was removed because it could interfere with other passes like GVN.
> https://lists.llvm.org/pipermail/llvm-dev/2016-September/105291.html
> https://lists.llvm.org/pipermail/llvm-dev/2019-September/135052.html

FYI, load merging at IR has some really hard cases.

One that I remember is that atomic loads are really problematic.  four one byte atomic loads are different than one 4 byte atomic atomic load.  Even if we have the four byte load on the target.  Once we've committed to the wider load type, we have no way to go back.  This greatly limits our optimization and lowering, and can lead to very poor outcomes.  We'd vaguely discussed the possibility of an IR extension for "element wise atomic vectors" to resolve this particular case, but it never progressed.

I believe there were a couple of other really hard examples too.  I just don't remember those. :)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D26149



More information about the llvm-commits mailing list