[PATCH] D61607: Introduce an option to stripPointerCasts to force the same bit pattern

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 21:28:04 PDT 2019


jdoerfert added a comment.

In D61607#1507697 <https://reviews.llvm.org/D61607#1507697>, @aykevl wrote:

> Yes I know it can change the bit pattern. And if it is only about the bit pattern, the name is fine. However, it seems to me that the only difference between `stripPointerCastsSameBitPattern` and `stripPointerCasts` is the AS, which may or may not be relevant to the bit pattern. This is confusing: it isn't clear to me from the name `stripPointerCastsSameBitPattern` whether it may strip any `addrspacecast` that has the same bit pattern.


I think I do not understand the problem. For me, it is all about the bit-pattern. But in general, I think users should not care what casts are stripped and which are not. It should be clear from the name and description what they can expect. Maybe someone adds logic here to determine if as-casts preserve the bit pattern. That will help users that need the same bit pattern, e.g., the `isNonNull` family of calls, and it will break with the strict no-as rule. If we add another "as-cast-like" instruction (like D59065 <https://reviews.llvm.org/D59065>) that might change the bit-pattern but not the "logical object" users of any `stripPointerCastsXXX` call should get the right value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61607





More information about the llvm-commits mailing list