[PATCH] D97665: [InstSimplify] Don't fold comparisons of non-inbounds GEPs

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 4 03:37:05 PST 2021


aqjune added a subscriber: nikic.
aqjune added a comment.

In D97665#2602696 <https://reviews.llvm.org/D97665#2602696>, @nikic wrote:

> The original case here was actually not "gep == null", but "ptrtoint gep == 0", in which case it's obviously a pure value comparison, but InstSimplify looks through that. Do you think that's the real issue?

Actually this is indeed a problematic transformation; you said a very valid point.
Removing it has large impact (it leaves ptrtoint to an object which is conservatively considered to escape the object), so simply removing the transformation is hard ATM, but I believe it should be removed at some point.

It is bad that there were two discussions with the same topic; maybe the link was not shared here because the Alive2's side did not have a very clear solution about ptr comparison as well. If I could answer anything clear about the pointer comparison, the link must have been shared :(

In D97665#2602738 <https://reviews.llvm.org/D97665#2602738>, @lebedev.ri wrote:

> (i've already been looking at the scev problem, maybe will post patch soon-ish)

+1, Fixing SCEV seems to be the easiest solution at this point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97665



More information about the llvm-commits mailing list