[PATCH] D137323: [InstCombine] Perform memset -> load forwarding

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 03:06:34 PDT 2022


nikic created this revision.
nikic added a reviewer: spatel.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

InstCombine does some basic store to load forwarding. One case it currently misses is the case where the store is actually a memset. This patch adds support for this case. This is a minimal implementation that only handles a load at the memset base address, without an offset.

GVN is already capable of performing this optimization. Having it in InstCombine can help with phase ordering issues, similar to the existing store to load forwarding.


https://reviews.llvm.org/D137323

Files:
  llvm/lib/Analysis/Loads.cpp
  llvm/test/Transforms/InstCombine/load-store-forward.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137323.472882.patch
Type: text/x-patch
Size: 5693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221103/38481179/attachment.bin>


More information about the llvm-commits mailing list