[PATCH] D134308: AtomicExpand: Use llvm.ptrmask instead of ptrtoint

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 09:10:39 PDT 2022


jyknight added a comment.

In D134308#3808652 <https://reviews.llvm.org/D134308#3808652>, @arsenm wrote:

> We don't want inttoptr or ptrtoint anywhere, since they still are capturing, but this is the limit of what is possible with current IR. We could push one of the ptrtoints later after doing the mask to get the LSB with the intrinsic, but you still need the ptrtoint to do the shift

OK -- it sounds like the root of the confusion here is that

>> My understanding:
>>
>> - converting from integer to pointer ("inttoptr") is undesirable to introduce in transformations. (Such instruciton may be present in the original input, but shouldn't be added if it was not.)
>> - converting from pointer to integer ("ptrtoint") is OK.

is incorrect. Sorry to be a pain, but do you have a link that describes the issues here? I may well not be remembering properly, but I had thought previous discussions and changes were about pointer provenance issues that arise from the inttoptr direction.

So I'm afraid I'm not at all clear to me why the ptrtoint is problematic -- and in particular, why you wrote in the change description that this might not actually be worth doing since we cannot remove the ptrtoint.


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

https://reviews.llvm.org/D134308



More information about the llvm-commits mailing list