This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Make AAMemoryLocationCallSite behavior sane
Needs ReviewPublic

Authored by jdoerfert on Aug 17 2020, 9:46 PM.

Details

Summary

Before this patch AAMemoryLocationCallSite did basically mirror the
corresponding AAMemoryLocationFunction. This has multiple drawbacks:

  • Things like the "ONLY_ARGMEMONLY" bit in the state mean different things for a store to an argument and a call since the latter is referring to the callee arguments.
  • We duplicated all accesses of the callee in the call site AA even though this is neither helpful nor can should we look at the instructions and pointers pointers in the context of the caller.

The new behavior decouples the call site argmemonly and
inaccessiblememorargmemonly attributes from the state such that the
call site can represent memory locations with regards to the caller. We
will only iterate over callee accesses to arguments and globals now and
we will use the call as the instruction that performs the access. If
accesses have argument pointers we translate them to improve the result,
though that was happening in a weird way before as well. Pointers to
globals are kept as well, if they were present. All other access kinds
are simply attributed to the call without any particular pointer
attachment.

Since we now track attributes wrt. the caller not callee we cannot
manifest the result easily. This can be revisited later.

Diff Detail

Event Timeline

jdoerfert created this revision.Aug 17 2020, 9:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2020, 9:46 PM
jdoerfert requested review of this revision.Aug 17 2020, 9:46 PM

An explicit test will be added.

Sorry for the delay.

An explicit test will be added.

Are you going to add this test?

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
6235

typo: known