[PATCH] D66608: [InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 14:15:34 PDT 2019


jdoerfert added a comment.

In D66608#1641754 <https://reviews.llvm.org/D66608#1641754>, @nikic wrote:

> As mentioned on the previous review, do we need to handle `getelementptr inbounds {}, {}* %p, i32 %idx`? That is, an inbounds GEP on a zero-sized type, which may be null for a non-zero index. It looks like this case is not handled in the existing code either though, so possibly this construction isn't legal (though I don't see anything to that effect in langref)?


Here it could cause problems, different other places we actually accumulate the index and decide based on the value, e.g., `Offset != 0`, which should avoid the problem.
Long story short, I guess we need another check in the if condition here.


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

https://reviews.llvm.org/D66608





More information about the llvm-commits mailing list