From 11f046ff784db04e80281c0cdb1ff65ec2717d3f Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Tue, 8 Aug 2017 21:25:26 +0000 Subject: [PATCH] BasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response llvm-svn: 310420 --- lib/Analysis/BasicAliasAnalysis.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 9bd4349835e..180e5f4a644 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -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)