Page MenuHomePhabricator

[Attributor] Merge D106720 and AACallEdges
Needs ReviewPublic

Authored by jdoerfert on Sep 20 2021, 9:34 AM.

Details

Summary

With three reachability related AAs things got complicated. D106720
introduced features that did not work properly as we could add new
queries after a fixpoint was reached and which could not be answered by
the information gathered up to the fixpoint alone.

This patch merges D106720 and AACallEdges to simplify the situation.
It also moves the "backwards" reachability out of D106720 and into
AA::isPotentiallyReachable. In addition to avoiding the fixpoint issue
described above, the new scheme allows to track reachability in one
place only. We do not have to redo work for backwards queries as the
caller already caches reachability. Asking the caller explicitly is the
right way to go here.

To test inter-procedural reachability in a reasonable way this patch
includes also an extension to AAPointerInfo::forallInterferingWrites.
Basically, we can exclude writes if they cannot reach a load "during the
lifetime" of the allocation. That is, we need to go up the call graph to
determine reachability until we can determine the allocation would be
dead in the caller. See value-simplify-pointer-info-gpu.ll.

Note: The new code contains plenty debug output to determine how
reachability queries are resolved.

Diff Detail

Event Timeline

jdoerfert created this revision.Sep 20 2021, 9:34 AM
jdoerfert requested review of this revision.Sep 20 2021, 9:34 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
jdoerfert updated this revision to Diff 373625.Sep 20 2021, 9:36 AM

Add test case

jdoerfert added inline comments.Sep 20 2021, 9:46 AM
llvm/include/llvm/Transforms/IPO/Attributor.h
4297

This class was removed. Replacement is just std::vector<AACallGraphNode*>::iterator.

4386

This class was merged in AACallGraphNode

jdoerfert updated this revision to Diff 373634.Sep 20 2021, 9:59 AM

Rebase based on "close to upstream"

jdoerfert updated this revision to Diff 373753.Sep 20 2021, 5:12 PM

Minor fixes