This is an archive of the discontinued LLVM Phabricator instance.

[PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class.
ClosedPublic

Authored by chandlerc on Jun 17 2015, 2:08 AM.

Details

Summary

This will allow classes to implement the AA interface without deriving
from the class or referencing an internal enum of some other class as
their return types.

Also, to a pretty fundamental extent, concepts such as 'NoAlias',
'MayAlias', and 'MustAlias' are first class concepts in LLVM and we
aren't saving anything by scoping them heavily.

My mild preference would have been to use a scoped enum, but that
feature is essentially completely broken AFAICT. I'm extremely
disappointed. For example, we cannot through any reasonable[1] means
construct an enum class (or analog) which has scoped names but converts
to a boolean in order to test for the possibility of aliasing.

[1]: Richard Smith came up with a "solution", but it requires class
templates, and lots of boilerplate setting up the enumeration multiple
times. Something like Boost.PP could potentially bundle this up, but
even that would be quite painful and it doesn't seem realistically worth
it. The enum class solution would probably work without the need for
a bool conversion.

Depends on D10494

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc updated this revision to Diff 27816.Jun 17 2015, 2:08 AM
chandlerc retitled this revision from to [PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class..
chandlerc updated this object.
chandlerc edited the test plan for this revision. (Show Details)
chandlerc added a subscriber: Unknown Object (MLST).
rengolin accepted this revision.Jun 17 2015, 4:03 AM
rengolin added a reviewer: rengolin.
rengolin added a subscriber: rengolin.

As advertised, LGTM.

This revision is now accepted and ready to land.Jun 17 2015, 4:03 AM

Thanks for the review Renato! Submitting!

This revision was automatically updated to reflect the committed changes.