[GMR] Only look in the associated allocs map for an underlying value if
authorChandler Carruth <chandlerc@gmail.com>
Wed, 22 Jul 2015 11:43:24 +0000 (11:43 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 22 Jul 2015 11:43:24 +0000 (11:43 +0000)
it wasn't one of the indirect globals (which clearly cannot be an
allocation function call). Also only do a single lookup into this map
instead of two. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242892 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IPA/GlobalsModRef.cpp

index 7713a5b647692fafff2d111b158c1ed25c4ffc82..c0fb3cdae1fe190c0b0964399fd33310cad1550f 100644 (file)
@@ -599,10 +599,10 @@ AliasResult GlobalsModRef::alias(const MemoryLocation &LocA,
 
   // These pointers may also be from an allocation for the indirect global.  If
   // so, also handle them.
-  if (AllocsForIndirectGlobals.count(UV1))
-    GV1 = AllocsForIndirectGlobals[UV1];
-  if (AllocsForIndirectGlobals.count(UV2))
-    GV2 = AllocsForIndirectGlobals[UV2];
+  if (!GV1)
+    GV1 = AllocsForIndirectGlobals.lookup(UV1);
+  if (!GV2)
+    GV2 = AllocsForIndirectGlobals.lookup(UV2);
 
   // Now that we know whether the two pointers are related to indirect globals,
   // use this to disambiguate the pointers. If the pointers are based on