[PATCH] D22080: [CFLAA] Simplify CFLGraphBuilder by removing InstantiatedRelations and InstantiatedAttrs

Jia Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 18:57:49 PDT 2016


grievejia created this revision.
grievejia added reviewers: george.burgess.iv, hfinkel.
grievejia added a subscriber: llvm-commits.

This is a code cleanup patch. No functionality change is introduced. It concludes the efforts of moving all information from the 5 auxiliary data structures in CFLGraphBuilder into the constructed CFLGraph.

To achieve the aforementioned goal, I changed the node type of CFLGraph from Value* to (Value*, DerefLevel) pair. With the change of node type, CFLGraph is now able to represent concepts like "derference value x 3 times", therefore it doesn't need InstantiatedRelations and InstantiatedAttrs any more to hold the information we get from interprocedural analysis.

Another change I made to the CFLGraph is that I tried to group together all nodes that share the same Value*.   Also, there's no need to explicit store Reference/Dereference edges because we know that it is always going to be the case that there exists a reference edge from (X, I) to (X, I-1) and a dereference edge form (X, I) to (X, I+1). For the purpose of consistency we disallow any other forms of reference/dereference edges. As a result, walking through a dereference chain becomes a fairly easy job (which is useful for implementing CFLAnders). I'm not satisfied with the API to perform the walkthrough, but I can't come up with a better alternative without making things less efficient.

The path also deprecates our previous hacks on StratifiedSets: noteAttributeBelow() and addBelowWith() is no longer needed, as we can take care of it at CFLGraph level. The patch also reveals another problem hidden in StratifiedSets::mergeDirect(): if it tries to merge two sets and neither set has anything up/below it, the attributes of those two sets won't get merged. Not sure if this is intentional or not. I added a line there to make sure the attribute merge is guaranteed.

http://reviews.llvm.org/D22080

Files:
  lib/Analysis/AliasAnalysisSummary.h
  lib/Analysis/CFLGraph.h
  lib/Analysis/CFLSteensAliasAnalysis.cpp
  lib/Analysis/StratifiedSets.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22080.63010.patch
Type: text/x-patch
Size: 30312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160707/327076b8/attachment.bin>


More information about the llvm-commits mailing list