[GMR] isNonEscapingGlobalNoAlias() should look through Bitcasts/GEPs when looking...
[oota-llvm.git] / lib / Analysis / IPA / GlobalsModRef.cpp
index 2798888ce7d108b922f22682e4a09ebfcf211672..5482a13d1e780c2854c56687db0ab4234ec46e69 100644 (file)
@@ -651,7 +651,7 @@ bool GlobalsModRef::isNonEscapingGlobalNoAlias(const GlobalValue *GV,
     if (auto *LI = dyn_cast<LoadInst>(Input)) {
       // A pointer loaded from a global would have been captured, and we know
       // that the global is non-escaping, so no alias.
-      if (isa<GlobalValue>(LI->getPointerOperand()))
+      if (isa<GlobalValue>(GetUnderlyingObject(LI->getPointerOperand(), *DL)))
         continue;
 
       // Otherwise, a load could come from anywhere, so bail.