This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Skip GetUnderlyingObject check in pointsToConstantMemory
ClosedPublic

Authored by arsenm on May 8 2020, 1:12 PM.

Details

Summary

Check the address space first before searching for the object
definition to save compile time. As an added bonus, this will now
treat casts to constant addrspace as constant.

We also seemed to be missing target tests for this, so add a few
missing other cases too.

Diff Detail

Event Timeline

arsenm created this revision.May 8 2020, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 1:13 PM

I do not think it is right:

int *p;
const int *x = p;

We cannot assume that x points to constant memory, just that we will not modify that memory via that pointer.

rampitec accepted this revision.May 8 2020, 1:44 PM

On the second thought, this is not an access qualifier but address space cast, and the only valid situation should be to cast from generic if memory is really constant... So presumably caller may specialize a generic pointer and call a special version of a function taking a pointer to constant. LGTM.

This revision is now accepted and ready to land.May 8 2020, 1:44 PM