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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 09:56:44 PDT 2019


reames added a comment.

I'm not sure that doing this at the IR level is the best idea.  The problem is that when we narrow, we loose the dereferenceable fact about part of the memory access.  This can in turn limit other transforms which would have been profitable.  As an example:
a = load <2 x i8>* p
b = load <2 x i8>* (p+1)
sum = a[0] + a[1] + b[1]

Narrowing the b load to i8 looses the fact that the memory location corresponding to b[0] is dereferenceable, which would prevent transforms such as:
a = load <4 x i8>* p
a[2] = 0;
sum = horizontal_sum(a);

(Note: I'm not saying this alternate transform is always profitable.  I'm just making a point about lost opportunity.)


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

https://reviews.llvm.org/D64432





More information about the llvm-commits mailing list