This is an archive of the discontinued LLVM Phabricator instance.

[getUnderlyingObject] support ptr_provenance
AcceptedPublic

Authored by jeroen.dobbelaere on Aug 3 2021, 8:09 AM.

Details

Summary

Allow to follow the pointer path through the computation operand 0 of llvm.experimental.ptr.provenance) or through the provenance (operand 1 of llvm.experimental.ptr.provenance).

Note: No further usage of this change is made at this moment. The BasicAliasAnalysis is mixing up the 'provenance' (as meant in ptr provenance and 'base' as where you end up when looking through the pointer computations. Any change there means choosing a policy (like explained in N2676 and others). At this moment, I am not sure what path to follow.

  • For full restrict, the idea is that the ptr_provenance and the underlying object of the computation end up to be the same. For N2676 this is not necessarily the case. Also for fixing issues related to GVN optimizing pointers based on 'equality', but losing provenance by doing so, this will also change that assumption.

Diff Detail

Event Timeline

jeroen.dobbelaere requested review of this revision.Aug 3 2021, 8:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2021, 8:09 AM
jeroen.dobbelaere edited the summary of this revision. (Show Details)
  • Rebased
  • Note: still need to update the (obsolete) comment
jeroen.dobbelaere added a reviewer: asbirlea.

Refer to UnknownProvenance instead of ConstantPointerNull in comment of getUnderlyingObject.

Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 7:06 AM
Zoxc added a subscriber: Zoxc.May 5 2022, 9:07 AM

It does kind of seem to me that getUnderlyingObject is intended to discover the provenance given that it discards GEPs. So always following the provenance path seems reasonable. However for full restrict the question to follow noalias intrinsics or not does appear to be more situational. So perhaps FollowProvenance should turn in to a FollowNoAlias argument?

I think this is fine, we can argue about the name but it won't matter much. A test would be nice though.

asbirlea accepted this revision.Jan 12 2023, 1:03 PM

I'm ok to not bikeshed this one at this time :-).

This revision is now accepted and ready to land.Jan 12 2023, 1:03 PM