[PATCH] D11410: [GMR] Teach GlobalsModRef to distinguish an important and safe case of no-alias with non-addr-taken globals: they cannot alias a captured pointer.

Chandler Carruth chandlerc at gmail.com
Sat Jul 25 00:07:35 PDT 2015

chandlerc added a comment.

Thanks for the measurements.

Anyone want to take a look at the code? I'd love an LGTM from someone before submitting.

Comment at: lib/Analysis/IPA/GlobalsModRef.cpp:716-721
@@ +715,8 @@
+        return NoAlias;
+      } else if (auto *LI = dyn_cast<LoadInst>(UV)) {
+        // A pointer loaded from a global would have been captured, and we know
+        // that GV is non-addr-taken, so no alias.
+        if (isa<GlobalValue>(LI->getPointerOperand()))
+          return NoAlias;
+      }
+    }
mzolotukhin wrote:
> Could you please give an example of how a load from non-global could alias with non-addr-taken global?
reg2mem, or spilling an SSA register for some ABI exception handling and then reloading, or any other transformation that uses memory within a function without impacting any other function.


More information about the llvm-commits mailing list