[PATCH] D75505: [InstCombine] Enhance cast-of-load->load-of-bitcast fold to handle multiple identical casts

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 00:49:23 PST 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic.
lebedev.ri added a project: LLVM.
Herald added subscribers: jfb, hiraditya.

Seen in real code, although not sure it's really impactful.
Currently the fold is limited to the case where there is a single use of load,
which is a cast, which generally makes sense. But if originally have
several identical casts in different BB's, and don't decide to hoist
them into some one BB, we won't CSE them, and the fold won't happen..

Instead, let's be smart, and let's simply natively handle the case
where all uses of load are identical casts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75505

Files:
  llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  llvm/test/Transforms/InstCombine/multi-use-load-casts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75505.247811.patch
Type: text/x-patch
Size: 4472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200303/6a675089/attachment.bin>


More information about the llvm-commits mailing list