[PATCH] D21000: [CFLAA] Cleaned up StratifiedAttrs handling

Jia Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 15:21:46 PDT 2016


grievejia added inline comments.

================
Comment at: lib/Analysis/CFLAliasAnalysis.cpp:1104-1111
@@ -1098,3 +1103,10 @@
   // argument or global, then we don't have to be as conservative.
-  if (AttrsA.any() && AttrsB.any())
+  if ((AttrsA.none() && AttrsB.any()) || (AttrsA.any() && AttrsB.none()))
+    return NoAlias;
+  if (AttrsA.test(AttrUnknownIndex) || AttrsB.test(AttrUnknownIndex))
+    return MayAlias;
+  if ((AttrsA.test(AttrEscapedIndex) && isGlobalOrArgAttr(AttrsB)) ||
+      (AttrsB.test(AttrEscapedIndex) && isGlobalOrArgAttr(AttrsA)))
+    return NoAlias;
+  if (isGlobalOrArgAttr(AttrsA) || isGlobalOrArgAttr(AttrsB))
     return MayAlias;
----------------
Aha, I see what you are saying. But I'm not sure moving the index check will simplify the logic here.

In general we have four types of sets: (1) AttrNone (2) AttrUnknown is set (3) only AttrEscaped is set (4) Any global/argument attr is set.

Let's perform a case-by-case analysis:
- (1) x (1): index check
- (1) x (2): NoAlias
- (1) x (3): NoAlias
- (1) x (4): NoAlias
- (2) x (2): MayAlias
- (2) x (3): MayAlias
- (2) x (4): MayAlias
- (3) x (3): index check
- (3) x (4): NoAlias
- (4) x (4): MayAlias

The puzzle here is to figure out the clearest way to express the above logic. I agree with you that I may not have the best answer, but simply putting the index check on top is not a panacea either. (Or I misunderstood what you're saying...)


http://reviews.llvm.org/D21000





More information about the llvm-commits mailing list