[PATCH] D117223: [GlobalOpt] Make global SRA offset based

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 08:33:13 PST 2022


reames added a comment.

Hm, your new code looks correct to me.

There's one case in the original code I don't see reflected in the new code though.  It doesn't appear to have any tests, and I'm not 100% sure it's reachable at all, but consider the following.

An outer struct with an inner array.  The index expression has a non-constant operand for the offset into the array.  (So, gep g, 0, v)  I believe the existing code will try to strip the struct off, and replace the global with the array.  Your code, because of the restriction to entirely constant offsets, will not.

In an opaque pointer world, this example can't arise.  If you wanted to add your code without removing the existing, and put the old code under a non-opaque pointer check, I'd be fine with that.  Though I'm really hoping you tell me I'm missing something and this case is impossible.  :)


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

https://reviews.llvm.org/D117223



More information about the llvm-commits mailing list