]> granicus.if.org Git - llvm/commit
[InstCombine] try to narrow a truncated load
authorSanjay Patel <spatel@rotateright.com>
Thu, 25 Jul 2019 12:14:27 +0000 (12:14 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 25 Jul 2019 12:14:27 +0000 (12:14 +0000)
commite8796a2846d76d0ab767238fbc4980af3c844ffd
treeb315036896aebbc65257a66305cd74ff52b81662
parent8049566cde7661d507653dd02773eaba6b2e347a
[InstCombine] try to narrow a truncated load

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
that reasoning may not apply to narrowing if we can preserve information
such as the dereferenceable range.

Differential Revision: https://reviews.llvm.org/D64432

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367011 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/trunc-load.ll