Index: llvm/include/llvm/Analysis/BasicAliasAnalysis.h =================================================================== --- llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -198,24 +198,19 @@ const SmallVectorImpl &Src); AliasResult aliasGEP(const GEPOperator *V1, LocationSize V1Size, - const AAMDNodes &V1AAInfo, const Value *V2, - LocationSize V2Size, const AAMDNodes &V2AAInfo, + const Value *V2, LocationSize V2Size, const Value *UnderlyingV1, const Value *UnderlyingV2, AAQueryInfo &AAQI); AliasResult aliasPHI(const PHINode *PN, LocationSize PNSize, - const AAMDNodes &PNAAInfo, const Value *V2, - LocationSize V2Size, const AAMDNodes &V2AAInfo, - AAQueryInfo &AAQI); + const Value *V2, LocationSize V2Size, AAQueryInfo &AAQI); AliasResult aliasSelect(const SelectInst *SI, LocationSize SISize, - const AAMDNodes &SIAAInfo, const Value *V2, - LocationSize V2Size, const AAMDNodes &V2AAInfo, + const Value *V2, LocationSize V2Size, AAQueryInfo &AAQI); AliasResult aliasCheck(const Value *V1, LocationSize V1Size, - const AAMDNodes &V1AATag, const Value *V2, - LocationSize V2Size, const AAMDNodes &V2AATag, + const Value *V2, LocationSize V2Size, AAQueryInfo &AAQI); }; Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp =================================================================== --- llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -800,8 +800,7 @@ AAQueryInfo &AAQI) { assert(notDifferentParent(LocA.Ptr, LocB.Ptr) && "BasicAliasAnalysis doesn't support interprocedural queries."); - return aliasCheck(LocA.Ptr, LocA.Size, LocA.AATags, LocB.Ptr, LocB.Size, - LocB.AATags, AAQI); + return aliasCheck(LocA.Ptr, LocA.Size, LocB.Ptr, LocB.Size, AAQI); } /// Checks to see if the specified callsite can clobber the specified memory @@ -1245,8 +1244,8 @@ /// UnderlyingV1 is getUnderlyingObject(GEP1), UnderlyingV2 is the same for /// V2. AliasResult BasicAAResult::aliasGEP( - const GEPOperator *GEP1, LocationSize V1Size, const AAMDNodes &V1AAInfo, - const Value *V2, LocationSize V2Size, const AAMDNodes &V2AAInfo, + const GEPOperator *GEP1, LocationSize V1Size, + const Value *V2, LocationSize V2Size, const Value *UnderlyingV1, const Value *UnderlyingV2, AAQueryInfo &AAQI) { DecomposedGEP DecompGEP1, DecompGEP2; unsigned MaxPointerSize = getMaxPointerSize(DL); @@ -1293,14 +1292,14 @@ MemoryLocation(UnderlyingV1), MemoryLocation(UnderlyingV2), AAQI); // For GEPs with identical sizes and offsets, we can preserve the size - // and AAInfo when performing the alias check on the underlying objects. + // when performing the alias check on the underlying objects. if (BaseAlias == MayAlias && V1Size == V2Size && GEP1BaseOffset == GEP2BaseOffset && DecompGEP1.VarIndices == DecompGEP2.VarIndices && !GEP1MaxLookupReached && !GEP2MaxLookupReached) { AliasResult PreciseBaseAlias = getBestAAResults().alias( - MemoryLocation(UnderlyingV1, V1Size, V1AAInfo), - MemoryLocation(UnderlyingV2, V2Size, V2AAInfo), AAQI); + MemoryLocation(UnderlyingV1, V1Size), + MemoryLocation(UnderlyingV2, V2Size), AAQI); if (PreciseBaseAlias == NoAlias) return NoAlias; } @@ -1346,8 +1345,7 @@ return MayAlias; AliasResult R = getBestAAResults().alias( - MemoryLocation(UnderlyingV1), - MemoryLocation(V2, LocationSize::unknown(), V2AAInfo), AAQI); + MemoryLocation(UnderlyingV1), MemoryLocation(V2), AAQI); 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 @@ -1484,52 +1482,49 @@ /// against another. AliasResult BasicAAResult::aliasSelect(const SelectInst *SI, LocationSize SISize, - const AAMDNodes &SIAAInfo, const Value *V2, - LocationSize V2Size, const AAMDNodes &V2AAInfo, + const Value *V2, LocationSize V2Size, AAQueryInfo &AAQI) { // If the values are Selects with the same condition, we can do a more precise // check: just check for aliases between the values on corresponding arms. if (const SelectInst *SI2 = dyn_cast(V2)) if (SI->getCondition() == SI2->getCondition()) { AliasResult Alias = getBestAAResults().alias( - MemoryLocation(SI->getTrueValue(), SISize, SIAAInfo), - MemoryLocation(SI2->getTrueValue(), V2Size, V2AAInfo), AAQI); + MemoryLocation(SI->getTrueValue(), SISize), + MemoryLocation(SI2->getTrueValue(), V2Size), AAQI); if (Alias == MayAlias) return MayAlias; AliasResult ThisAlias = getBestAAResults().alias( - MemoryLocation(SI->getFalseValue(), SISize, SIAAInfo), - MemoryLocation(SI2->getFalseValue(), V2Size, V2AAInfo), AAQI); + MemoryLocation(SI->getFalseValue(), SISize), + MemoryLocation(SI2->getFalseValue(), V2Size), AAQI); return MergeAliasResults(ThisAlias, Alias); } // If both arms of the Select node NoAlias or MustAlias V2, then returns // NoAlias / MustAlias. Otherwise, returns MayAlias. AliasResult Alias = getBestAAResults().alias( - MemoryLocation(V2, V2Size, V2AAInfo), - MemoryLocation(SI->getTrueValue(), SISize, SIAAInfo), AAQI); + MemoryLocation(V2, V2Size), + MemoryLocation(SI->getTrueValue(), SISize), AAQI); if (Alias == MayAlias) return MayAlias; AliasResult ThisAlias = getBestAAResults().alias( - MemoryLocation(V2, V2Size, V2AAInfo), - MemoryLocation(SI->getFalseValue(), SISize, SIAAInfo), AAQI); + MemoryLocation(V2, V2Size), + MemoryLocation(SI->getFalseValue(), SISize), AAQI); return MergeAliasResults(ThisAlias, Alias); } /// Provide a bunch of ad-hoc rules to disambiguate a PHI instruction against /// another. AliasResult BasicAAResult::aliasPHI(const PHINode *PN, LocationSize PNSize, - const AAMDNodes &PNAAInfo, const Value *V2, - LocationSize V2Size, - const AAMDNodes &V2AAInfo, + const Value *V2, LocationSize V2Size, AAQueryInfo &AAQI) { // If the values are PHIs in the same block, we can do a more precise // as well as efficient check: just check for aliases between the values // on corresponding edges. if (const PHINode *PN2 = dyn_cast(V2)) if (PN2->getParent() == PN->getParent()) { - AAQueryInfo::LocPair Locs(MemoryLocation(PN, PNSize, PNAAInfo), - MemoryLocation(V2, V2Size, V2AAInfo)); + AAQueryInfo::LocPair Locs(MemoryLocation(PN, PNSize), + MemoryLocation(V2, V2Size)); if (PN > V2) std::swap(Locs.first, Locs.second); // Analyse the PHIs' inputs under the assumption that the PHIs are @@ -1552,10 +1547,10 @@ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { AliasResult ThisAlias = getBestAAResults().alias( - MemoryLocation(PN->getIncomingValue(i), PNSize, PNAAInfo), + MemoryLocation(PN->getIncomingValue(i), PNSize), MemoryLocation( - PN2->getIncomingValueForBlock(PN->getIncomingBlock(i)), V2Size, - V2AAInfo), AAQI); + PN2->getIncomingValueForBlock(PN->getIncomingBlock(i)), V2Size), + AAQI); Alias = MergeAliasResults(ThisAlias, Alias); if (Alias == MayAlias) break; @@ -1656,8 +1651,8 @@ AAQueryInfo *UseAAQI = BlockInserted ? &NewAAQI : &AAQI; AliasResult Alias = getBestAAResults().alias( - MemoryLocation(V2, V2Size, V2AAInfo), - MemoryLocation(V1Srcs[0], PNSize, PNAAInfo), *UseAAQI); + MemoryLocation(V2, V2Size), + MemoryLocation(V1Srcs[0], PNSize), *UseAAQI); // Early exit if the check of the first PHI source against V2 is MayAlias. // Other results are not possible. @@ -1674,8 +1669,7 @@ Value *V = V1Srcs[i]; AliasResult ThisAlias = getBestAAResults().alias( - MemoryLocation(V2, V2Size, V2AAInfo), - MemoryLocation(V, PNSize, PNAAInfo), *UseAAQI); + MemoryLocation(V2, V2Size), MemoryLocation(V, PNSize), *UseAAQI); Alias = MergeAliasResults(ThisAlias, Alias); if (Alias == MayAlias) break; @@ -1687,9 +1681,7 @@ /// Provides a bunch of ad-hoc rules to disambiguate in common cases, such as /// array references. AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size, - const AAMDNodes &V1AAInfo, const Value *V2, LocationSize V2Size, - const AAMDNodes &V2AAInfo, AAQueryInfo &AAQI) { // If either of the memory references is empty, it doesn't matter what the // pointer values are. @@ -1776,8 +1768,8 @@ // Check the cache before climbing up use-def chains. This also terminates // otherwise infinitely recursive queries. - AAQueryInfo::LocPair Locs(MemoryLocation(V1, V1Size, V1AAInfo), - MemoryLocation(V2, V2Size, V2AAInfo)); + AAQueryInfo::LocPair Locs(MemoryLocation(V1, V1Size), + MemoryLocation(V2, V2Size)); if (V1 > V2) std::swap(Locs.first, Locs.second); std::pair Pair = @@ -1788,37 +1780,31 @@ // FIXME: This isn't aggressively handling alias(GEP, PHI) for example: if the // GEP can't simplify, we don't even look at the PHI cases. if (const GEPOperator *GV1 = dyn_cast(V1)) { - AliasResult Result = - aliasGEP(GV1, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, O1, O2, AAQI); + AliasResult Result = aliasGEP(GV1, V1Size, V2, V2Size, O1, O2, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); } else if (const GEPOperator *GV2 = dyn_cast(V2)) { - AliasResult Result = - aliasGEP(GV2, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, O2, O1, AAQI); + AliasResult Result = aliasGEP(GV2, V2Size, V1, V1Size, O2, O1, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); } if (const PHINode *PN = dyn_cast(V1)) { - AliasResult Result = - aliasPHI(PN, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, AAQI); + AliasResult Result = aliasPHI(PN, V1Size, V2, V2Size, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); } else if (const PHINode *PN = dyn_cast(V2)) { - AliasResult Result = - aliasPHI(PN, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, AAQI); + AliasResult Result = aliasPHI(PN, V2Size, V1, V1Size, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); } if (const SelectInst *S1 = dyn_cast(V1)) { - AliasResult Result = - aliasSelect(S1, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, AAQI); + AliasResult Result = aliasSelect(S1, V1Size, V2, V2Size, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); } else if (const SelectInst *S2 = dyn_cast(V2)) { - AliasResult Result = - aliasSelect(S2, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, AAQI); + AliasResult Result = aliasSelect(S2, V2Size, V1, V1Size, AAQI); if (Result != MayAlias) return AAQI.updateResult(Locs, Result); }