summaryrefslogtreecommitdiff
path: root/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
commitbec2df684fda75a1120ba2eeac45ee438595739e (patch)
treeb60e190ff68d79071f3dbb3b6ce719df73e61e94 /lib/Analysis/StratifiedSets.h
parentaf4c28d141504a4283d93b2236ec3b6eed9b5d80 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/StratifiedSets.h')
-rw-r--r--lib/Analysis/StratifiedSets.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Analysis/StratifiedSets.h b/lib/Analysis/StratifiedSets.h
index ae1befbdf95..0e20343af1e 100644
--- a/lib/Analysis/StratifiedSets.h
+++ b/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);