[PATCH] D96399: [X86][CodeGenPrepare] Try to reuse IV's incremented value instead of adding the offset

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 22:29:58 PST 2021


mkazantsev added a comment.

> You're code is specific to generating the address as GEPs. I think we want to handle this for the non-GEP path as well.



> I think this makes more sense to phrase as an optimization step for the AddrMode we're about to sink. Doing it that way should also address (1) above.

Agreed. I tried doing this during AddrMode computation, but it's impossible because it's lacking knowledge about the user. But I think it can be hoisted out of condition.

> I think I might see the correctness issue, or at least a hint of it. Consider the case where addressing does overflow. The wrapping semantics of a GEP are not the same as the usubo. That difference means that if overflow occurs, your optimized AddrMode is incorrect. I believe you need to restrict this transform to when you can prove overflow causes the memory inst not to be reached.

I don't quite get the point here. If overflow occurs in optimized case, it also occurs in non-optimized case. My transform does not change the actual offset, it just simplifies the way how it's computed.


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

https://reviews.llvm.org/D96399



More information about the llvm-commits mailing list