This is an archive of the discontinued LLVM Phabricator instance.

Update memref type doc on aliasing guarantee across memory spaces
Needs ReviewPublic

Authored by bondhugula on Mar 8 2022, 8:07 PM.

Details

Summary

Update memref type doc to add that memrefs in different memory spaces
cannot alias with each other. This allows aliasing checks to be more
powerful and enforces a useful restriction/canonicalization.

While on this, fix a stale statement.

Diff Detail

Event Timeline

bondhugula created this revision.Mar 8 2022, 8:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 8:07 PM
bondhugula requested review of this revision.Mar 8 2022, 8:07 PM
bondhugula updated this revision to Diff 413999.Mar 8 2022, 8:27 PM
bondhugula edited the summary of this revision. (Show Details)

Fix stale statement.

Is this actually safe though? In LLVM, address spaces are allowed to alias. For example, you could have a hierarchy of memory regions, where some address spaces are a superset of the others (and thus can alias), and could even have the old x86-16 segment-offset style thing where you have pervasive aliases possible. I believe that LLVM pointer address spaces support this sort of thing.

Is this actually safe though? In LLVM, address spaces are allowed to alias. For example, you could have a hierarchy of memory regions, where some address spaces are a superset of the others (and thus can alias), and could even have the old x86-16 segment-offset style thing where you have pervasive aliases possible. I believe that LLVM pointer address spaces support this sort of thing.

Do you foresee needing such low-level abstractions and unrestricted generality on the memref type? The memref type is not used with the LLVM dialect - so you can still have such address space aliasing in the LLVM dialect or other similar dialects that are closer to the target.

jrtc27 added a subscriber: jrtc27.Mar 23 2022, 8:00 AM

Address spaces can also be used for the exact same memory but a different representation of the pointers, which can come with semantic differences; we use them in CHERI LLVM to differentiate between traditional integer addresses and CHERI capabilities, with the latter having associated bounds and permissions to provide spatial safety.