BasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response
authorNuno Lopes <nunoplopes@sapo.pt>
Tue, 8 Aug 2017 21:25:26 +0000 (21:25 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Tue, 8 Aug 2017 21:25:26 +0000 (21:25 +0000)
llvm-svn: 310420

llvm/lib/Analysis/BasicAliasAnalysis.cpp

index 9bd4349835ec8db296166a4358f4bfda6a690c22..180e5f4a644e1fc3eca65814899bd3d53b5a6940 100644 (file)
@@ -1238,13 +1238,15 @@ AliasResult BasicAAResult::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
     AliasResult R = aliasCheck(UnderlyingV1, MemoryLocation::UnknownSize,
                                AAMDNodes(), V2, MemoryLocation::UnknownSize,
                                V2AAInfo, nullptr, UnderlyingV2);
-    if (R != MustAlias)
+    if (R != MustAlias) {
       // If V2 may alias GEP base pointer, conservatively returns MayAlias.
       // If V2 is known not to alias GEP base pointer, then the two values
       // cannot alias per GEP semantics: "Any memory access must be done through
       // a pointer value associated with an address range of the memory access,
       // otherwise the behavior is undefined.".
+      assert(R == NoAlias || R == MayAlias);
       return R;
+    }
 
     // If the max search depth is reached the result is undefined
     if (GEP1MaxLookupReached)