[PATCH] D22981: [CFLAA] Make CFLAnders conservative when it sees newly created values

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 11:35:13 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277362: [CFLAA] Make CFLAnders more conservative with new Values. (authored by gbiv).

Changed prior to commit:
  https://reviews.llvm.org/D22981?vs=66199&id=66344#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22981

Files:
  llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp

Index: llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp
===================================================================
--- llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp
+++ llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp
@@ -213,8 +213,6 @@
   typedef MapType::const_iterator const_iterator;
 
   bool add(InstantiatedValue V, AliasAttrs Attr) {
-    if (Attr.none())
-      return false;
     auto &OldAttr = AttrMap[V];
     auto NewAttr = OldAttr | Attr;
     if (OldAttr == NewAttr)
@@ -346,9 +344,11 @@
   for (const auto &Mapping : AMap.mappings()) {
     auto IVal = Mapping.first;
 
+    // Insert IVal into the map
+    auto &Attr = AttrMap[IVal.Val];
     // AttrMap only cares about top-level values
     if (IVal.DerefLevel == 0)
-      AttrMap[IVal.Val] |= Mapping.second;
+      Attr |= Mapping.second;
   }
 }
 
@@ -482,7 +482,10 @@
 AliasAttrs CFLAndersAAResult::FunctionInfo::getAttrs(const Value *V) const {
   assert(V != nullptr);
 
-  AliasAttrs Attr;
+  // Return AttrUnknown if V is not found in AttrMap. Sometimes V can be created
+  // after the analysis gets executed, and we want to be conservative in
+  // those cases.
+  AliasAttrs Attr = getAttrUnknown();
   auto Itr = AttrMap.find(V);
   if (Itr != AttrMap.end())
     Attr = Itr->second;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22981.66344.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160801/e465da4c/attachment.bin>


More information about the llvm-commits mailing list