This is an archive of the discontinued LLVM Phabricator instance.

[CFLAA] Remove non-pointer values from CFLGraph
ClosedPublic

Authored by grievejia on Jun 15 2016, 9:24 AM.

Details

Summary

This patch introduces no functionality changes.

The goal is to only let CFLAA track pointer values. Non-pointer values do not need to be added to CFLGraph, and any alias queries involving at least one non-pointer value can be answered with "NoAlias" (basicaa does this so I guess with the introduction of AttrEscape it would be fine for CFLAA to do it as well).

One more change has to be done to achieve this goal, though. For instructions like ptrtoint, the operand is a pointer yet the result is not. Ideally we would want to add the operand to CFLGraph and tag it as AttrEscape, and just ignore the result. However, without this patch we cannot do that since StratifiedAttrs are attached to CFLGrpah's edges, not nodes. All we can do there was to add an edge from the operand to the result with AttrEscape attached to the edge, but then we have to add a non-pointer value (the result) as a node to the graph. This patch fix this issue by moving StratifiedAttrs from edges to nodes.

Diff Detail

Repository
rL LLVM

Event Timeline

grievejia updated this revision to Diff 60850.Jun 15 2016, 9:24 AM
grievejia retitled this revision from to [CFLAA] Remove non-pointer values from CFLGraph.
grievejia updated this object.
grievejia added a subscriber: llvm-commits.

It's not clear to me why you don't, long term, end up with attributes both
for edges and nodes.

For example, for edges, to support field-sensitive analysis, you will
either need the offset or something as an edge attribute, so you can
differentiate what edge to follow for a given offset.
(unless y'all know another way)

grievejia added a comment.EditedJun 15 2016, 10:06 AM

It's not clear to me why you don't, long term, end up with attributes both
for edges and nodes.

For example, for edges, to support field-sensitive analysis, you will
either need the offset or something as an edge attribute, so you can
differentiate what edge to follow for a given offset.
(unless y'all know another way)

Edge attributes could be useful. I totally agree.

However, the semanitics of StratifiedAttr, in it current form, describes something about nodes, not edges. When CFLGraph gets translated to StratifiedSets, those "edge" attributes on CFLGraph will become "node" attributes in StratifiedSets anyway. So IMO it makes more sense to move StratifiedAttr from edges to nodes in CFLGraph.

You are right that for field sensitivity we may need to attach certain information to edges in the future. But those information will look very different from the StratifiedAttr we have right now.

SGTM then.
I'll let george continue taking a look.

george.burgess.iv edited edge metadata.

LGTM -- thanks for the patch!

This revision is now accepted and ready to land.Jun 15 2016, 1:42 PM
This revision was automatically updated to reflect the committed changes.