[PATCH] D12838: [GlobalsAA] Teach GlobalsAA about nocapture

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 00:02:52 PDT 2015

hfinkel added inline comments.

Comment at: lib/Analysis/GlobalsModRef.cpp:806
@@ +805,3 @@
+  for (auto &A : CS.args())
+    if (GetUnderlyingObject(A, DL) == GV)
+      return ConservativeResult;
This check does not seem conservative enough. GetUnderlyingObject has a depth limit, and cannot look through PHIs/selects. Since we know that GV is not captured as a precondition of this function (which we should explicitly document), calling GetUnderlyingObjects with no depth limit might be conservatively correct, although I'm afraid of unbounded compile-time in that case, Alternatively, you can call GetUnderlyingObject (or better, GetUnderlyingObjects), but return conservatively if not all returned objects are such that isIdentifiedObject returns true.



More information about the llvm-commits mailing list