This is an archive of the discontinued LLVM Phabricator instance.

Improve BasicAA CS-CS queries
ClosedPublic

Authored by hfinkel on Jun 28 2014, 5:21 AM.

Details

Summary

BasicAA contains knowledge of certain intrinsics, such as memcpy and memset, and uses that information to form more-accurate answers to CallSite vs. Loc ModRef queries. Unfortunately, it does not use this information when answering CallSite vs. CallSite queries.

Generically, when an intrinsic takes one or more pointers and the intrinsic is marked only to read/write from its arguments, the offset/size is unknown. As a result, the generic code that answers CallSite vs. CallSite (and CallSite vs. Loc) queries in AA uses UnknownSize when forming Locs from an intrinsic's arguments. While BasicAA's CallSite vs. Loc override could use more-accurate size information for some intrinsics, it did not do the same for CallSite vs. CallSite queries.

This patch refactors the intrinsic-specific logic in BasicAA into a generic AA query function: getArgLocation, which is overridden by BasicAA to supply the intrinsic-specific knowledge, and used by AA's generic implementation. This allows the intrinsic-specific knowledge to be used by both CallSite vs. Loc and CallSite vs. CallSite queries, and simplifies the BasicAA implementation.

Currently, only one function, Mac's memset_pattern16, is handled by BasicAA (all the rest are intrinsics). As a side-effect of this refactoring, BasicAA's getModRefBehavior override now also returns OnlyAccessesArgumentPointees for this function (which is an improvement).

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 10963.Jun 28 2014, 5:21 AM
hfinkel retitled this revision from to Improve BasicAA CS-CS queries.
hfinkel updated this object.
hfinkel edited the test plan for this revision. (Show Details)
hfinkel added reviewers: aschwaighofer, sunfish.
hfinkel added a subscriber: Unknown Object (MLST).
aschwaighofer edited edge metadata.Jul 8 2014, 8:34 AM

LGTM. Sorry for the delay.

hfinkel accepted this revision.Jul 8 2014, 4:25 PM
hfinkel added a reviewer: hfinkel.

Committed r212572. Thanks!

This revision is now accepted and ready to land.Jul 8 2014, 4:25 PM
hfinkel closed this revision.Jul 10 2014, 8:49 PM

Committed r212572.