[PATCH] D11900: [GMR] Be a bit smarter about which globals alias when doing recursive lookups

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 11:32:34 PDT 2015


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM with nit picks below.


================
Comment at: lib/Analysis/IPA/GlobalsModRef.cpp:720
@@ -719,7 +719,3 @@
 
-      // FIXME: It would be good to handle other obvious no-alias cases here, but
-      // it isn't clear how to do so reasonbly without building a small version
-      // of BasicAA into this code. We could recurse into AliasAnalysis::alias
-      // here but that seems likely to go poorly as we're inside the
-      // implementation of such a query. Until then, just conservatievly retun
-      // false.
+      // Distinct GlobalVariables never alias, unless zero-sized.
+      // FIXME: The condition can be refined, but be conservative for now.
----------------
"... never alias, unless overridden or zero-sized."

================
Comment at: lib/Analysis/IPA/GlobalsModRef.cpp:728-729
@@ +727,4 @@
+          !GVar->mayBeOverridden() && !InputGVar->mayBeOverridden() &&
+          DL->getTypeAllocSize(GVar->getInitializer()->getType()) &&
+          DL->getTypeAllocSize(InputGVar->getInitializer()->getType()))
+        continue;
----------------
I would explicitly write "> 0" for these.


http://reviews.llvm.org/D11900





More information about the llvm-commits mailing list