summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/StratifiedSets.h
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2016-06-09 23:15:04 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2016-06-09 23:15:04 +0000
commit652ec4f595001376fe5a61edae9df42047c907cc (patch)
treec801b3a139a01de934c77be19f900ae993444ad8 /llvm/lib/Analysis/StratifiedSets.h
parent79b75d3d11119b9c84a06066c6092ac2799728ca (diff)
downloadbcm5719-llvm-652ec4f595001376fe5a61edae9df42047c907cc.tar.gz
bcm5719-llvm-652ec4f595001376fe5a61edae9df42047c907cc.zip
[CFLAA] Handle global/arg attrs more sanely.
Prior to this patch, we used argument/global stratified attributes in order to note that a value could have come from either dereferencing a global/arg, or from the assignment from a global/arg. Now, AttrUnknown is placed on sets when we see a dereference, instead of the global/arg attributes. This allows us to be more aggressive in the future when we see global/arg attributes without AttrUnknown. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21110 llvm-svn: 272335
Diffstat (limited to 'llvm/lib/Analysis/StratifiedSets.h')
-rw-r--r--llvm/lib/Analysis/StratifiedSets.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/StratifiedSets.h b/llvm/lib/Analysis/StratifiedSets.h
index ae1befbdf95..0e20343af1e 100644
--- a/llvm/lib/Analysis/StratifiedSets.h
+++ b/llvm/lib/Analysis/StratifiedSets.h
@@ -395,6 +395,17 @@ public:
return addAtMerging(ToAdd, Below);
}
+ /// \brief Set the StratifiedAttrs of the set below "Main". If there is no set
+ /// below "Main", create one for it.
+ void addAttributesBelow(const T &Main, StratifiedAttrs Attr) {
+ assert(has(Main));
+ auto Index = *indexOf(Main);
+ auto Link = linksAt(Index);
+
+ auto BelowIndex = Link.hasBelow() ? Link.getBelow() : addLinkBelow(Index);
+ linksAt(BelowIndex).setAttrs(Attr);
+ }
+
bool addWith(const T &Main, const T &ToAdd) {
assert(has(Main));
auto MainIndex = *indexOf(Main);
OpenPOWER on IntegriCloud