[PATCH] D64432: [InstCombine] try to narrow a truncated load

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 11:31:45 PDT 2019


spatel created this revision.
spatel added reviewers: reames, hfinkel, arsenm.
Herald added subscribers: hiraditya, wdng, mcrosier.
Herald added a project: LLVM.

trunc (load X) --> load (bitcast X to narrow type)

We have this transform in DAGCombiner::ReduceLoadWidth(), but the truncated load pattern can interfere with other instcombine transforms, so I'd like to allow the fold sooner.

Example:
https://bugs.llvm.org/show_bug.cgi?id=16739
...in that report, we have bitcasts bracketing these ops, so those could get eliminated too.

We've generally ruled out widening of loads early in IR ( LoadCombine - http://lists.llvm.org/pipermail/llvm-dev/2016-September/105291.html ), but I'm not sure if that reasoning applies to narrowing.

There's another request for narrowing in IR here, but it's a different pattern:
https://bugs.llvm.org/show_bug.cgi?id=42424


https://reviews.llvm.org/D64432

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/InstCombine/trunc-load.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64432.208748.patch
Type: text/x-patch
Size: 5085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190709/080d5fe8/attachment.bin>


More information about the llvm-commits mailing list