diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h --- a/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -479,7 +479,7 @@ /// A trivial helper function to check to see if the specified pointers are /// no-alias. bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) { - return alias(LocA, LocB) == NoAlias; + return alias(LocA, LocB) == AliasResult::NoAlias; } /// A convenience wrapper around the \c isNoAlias helper interface. @@ -497,13 +497,13 @@ /// A trivial helper function to check to see if the specified pointers are /// must-alias. bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) { - return alias(LocA, LocB) == MustAlias; + return alias(LocA, LocB) == AliasResult::MustAlias; } /// A convenience wrapper around the \c isMustAlias helper interface. bool isMustAlias(const Value *V1, const Value *V2) { return alias(V1, LocationSize::precise(1), V2, LocationSize::precise(1)) == - MustAlias; + AliasResult::MustAlias; } /// Checks whether the given location points to constant memory, or if @@ -890,11 +890,12 @@ return AA.getModRefBehavior(Call); } bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) { - return alias(LocA, LocB) == MustAlias; + return alias(LocA, LocB) == AliasResult::MustAlias; } bool isMustAlias(const Value *V1, const Value *V2) { return alias(MemoryLocation(V1, LocationSize::precise(1)), - MemoryLocation(V2, LocationSize::precise(1))) == MustAlias; + MemoryLocation(V2, LocationSize::precise(1))) == + AliasResult::MustAlias; } Optional getClobberOffset(const MemoryLocation &LocA, const MemoryLocation &LocB) const; @@ -1124,7 +1125,7 @@ public: AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI) { - return MayAlias; + return AliasResult::MayAlias; } bool pointsToConstantMemory(const MemoryLocation &Loc, AAQueryInfo &AAQI, diff --git a/llvm/include/llvm/Analysis/CFLSteensAliasAnalysis.h b/llvm/include/llvm/Analysis/CFLSteensAliasAnalysis.h --- a/llvm/include/llvm/Analysis/CFLSteensAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/CFLSteensAliasAnalysis.h @@ -73,7 +73,7 @@ AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI) { if (LocA.Ptr == LocB.Ptr) - return MustAlias; + return AliasResult::MustAlias; // Comparisons between global variables and other constants should be // handled by BasicAA. @@ -84,7 +84,7 @@ return AAResultBase::alias(LocA, LocB, AAQI); AliasResult QueryResult = query(LocA, LocB); - if (QueryResult == MayAlias) + if (QueryResult == AliasResult::MayAlias) return AAResultBase::alias(LocA, LocB, AAQI); return QueryResult; diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -288,7 +288,7 @@ DeleteValueTy DeleteValue, Instruction *MI, BasicBlock *BB, unsigned NumOperands) : MemoryAccess(C, Vty, DeleteValue, BB, NumOperands), - MemoryInstruction(MI), OptimizedAccessAlias(MayAlias) { + MemoryInstruction(MI), OptimizedAccessAlias(AliasResult::MayAlias) { setDefiningAccess(DMA); } @@ -300,7 +300,7 @@ } void setDefiningAccess(MemoryAccess *DMA, bool Optimized = false, - Optional AR = MayAlias) { + Optional AR = AliasResult::MayAlias) { if (!Optimized) { setOperand(0, DMA); return; diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -123,7 +123,7 @@ AliasResult AAResults::alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI) { - AliasResult Result = MayAlias; + AliasResult Result = AliasResult::MayAlias; if (EnableAATrace) { for (unsigned I = 0; I < AAQI.Depth; ++I) @@ -135,7 +135,7 @@ AAQI.Depth++; for (const auto &AA : AAs) { Result = AA->alias(LocA, LocB, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) break; } AAQI.Depth--; @@ -148,9 +148,9 @@ } if (AAQI.Depth == 0) { - if (Result == NoAlias) + if (Result == AliasResult::NoAlias) ++NumNoAlias; - else if (Result == MustAlias) + else if (Result == AliasResult::MustAlias) ++NumMustAlias; else ++NumMayAlias; @@ -256,12 +256,12 @@ MemoryLocation ArgLoc = MemoryLocation::getForArgument(Call, ArgIdx, TLI); AliasResult ArgAlias = alias(ArgLoc, Loc, AAQI); - if (ArgAlias != NoAlias) { + if (ArgAlias != AliasResult::NoAlias) { ModRefInfo ArgMask = getArgModRefInfo(Call, ArgIdx); AllArgsMask = unionModRef(AllArgsMask, ArgMask); } // Conservatively clear IsMustAlias unless only MustAlias is found. - IsMustAlias &= (ArgAlias == MustAlias); + IsMustAlias &= (ArgAlias == AliasResult::MustAlias); } } // Return NoModRef if no alias found with any argument. @@ -449,16 +449,16 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, AliasResult AR) { switch (AR) { - case NoAlias: + case AliasResult::NoAlias: OS << "NoAlias"; break; - case MustAlias: + case AliasResult::MustAlias: OS << "MustAlias"; break; - case MayAlias: + case AliasResult::MayAlias: OS << "MayAlias"; break; - case PartialAlias: + case AliasResult::PartialAlias: OS << "PartialAlias"; break; } @@ -485,9 +485,9 @@ // or write the specified memory. if (Loc.Ptr) { AliasResult AR = alias(MemoryLocation::get(L), Loc, AAQI); - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) return ModRefInfo::NoModRef; - if (AR == MustAlias) + if (AR == AliasResult::MustAlias) return ModRefInfo::MustRef; } // Otherwise, a load just reads. @@ -510,7 +510,7 @@ AliasResult AR = alias(MemoryLocation::get(S), Loc, AAQI); // If the store address cannot alias the pointer in question, then the // specified memory cannot be modified by the store. - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) return ModRefInfo::NoModRef; // If the pointer is a pointer to constant memory, then it could not have @@ -519,7 +519,7 @@ return ModRefInfo::NoModRef; // If the store address aliases the pointer as must alias, set Must. - if (AR == MustAlias) + if (AR == AliasResult::MustAlias) return ModRefInfo::MustMod; } @@ -555,7 +555,7 @@ AliasResult AR = alias(MemoryLocation::get(V), Loc, AAQI); // If the va_arg address cannot alias the pointer in question, then the // specified memory cannot be accessed by the va_arg. - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) return ModRefInfo::NoModRef; // If the pointer is a pointer to constant memory, then it could not have @@ -564,7 +564,7 @@ return ModRefInfo::NoModRef; // If the va_arg aliases the pointer as must alias, set Must. - if (AR == MustAlias) + if (AR == AliasResult::MustAlias) return ModRefInfo::MustModRef; } @@ -629,11 +629,11 @@ AliasResult AR = alias(MemoryLocation::get(CX), Loc, AAQI); // If the cmpxchg address does not alias the location, it does not access // it. - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) return ModRefInfo::NoModRef; // If the cmpxchg address aliases the pointer as must alias, set Must. - if (AR == MustAlias) + if (AR == AliasResult::MustAlias) return ModRefInfo::MustModRef; } @@ -657,11 +657,11 @@ AliasResult AR = alias(MemoryLocation::get(RMW), Loc, AAQI); // If the atomicrmw address does not alias the location, it does not access // it. - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) return ModRefInfo::NoModRef; // If the atomicrmw address aliases the pointer as must alias, set Must. - if (AR == MustAlias) + if (AR == AliasResult::MustAlias) return ModRefInfo::MustModRef; } @@ -751,9 +751,9 @@ // is impossible to alias the pointer we're checking. If not, we have to // assume that the call could touch the pointer, even though it doesn't // escape. - if (AR != MustAlias) + if (AR != AliasResult::MustAlias) IsMustAlias = false; - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) continue; if (Call->doesNotAccessMemory(ArgNo)) continue; diff --git a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp --- a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -151,19 +151,19 @@ AliasResult AR = AA.alias(*I1, I1Size, *I2, I2Size); switch (AR) { - case NoAlias: + case AliasResult::NoAlias: PrintResults(AR, PrintNoAlias, *I1, *I2, F.getParent()); ++NoAliasCount; break; - case MayAlias: + case AliasResult::MayAlias: PrintResults(AR, PrintMayAlias, *I1, *I2, F.getParent()); ++MayAliasCount; break; - case PartialAlias: + case AliasResult::PartialAlias: PrintResults(AR, PrintPartialAlias, *I1, *I2, F.getParent()); ++PartialAliasCount; break; - case MustAlias: + case AliasResult::MustAlias: PrintResults(AR, PrintMustAlias, *I1, *I2, F.getParent()); ++MustAliasCount; break; @@ -178,19 +178,19 @@ AliasResult AR = AA.alias(MemoryLocation::get(cast(Load)), MemoryLocation::get(cast(Store))); switch (AR) { - case NoAlias: + case AliasResult::NoAlias: PrintLoadStoreResults(AR, PrintNoAlias, Load, Store, F.getParent()); ++NoAliasCount; break; - case MayAlias: + case AliasResult::MayAlias: PrintLoadStoreResults(AR, PrintMayAlias, Load, Store, F.getParent()); ++MayAliasCount; break; - case PartialAlias: + case AliasResult::PartialAlias: PrintLoadStoreResults(AR, PrintPartialAlias, Load, Store, F.getParent()); ++PartialAliasCount; break; - case MustAlias: + case AliasResult::MustAlias: PrintLoadStoreResults(AR, PrintMustAlias, Load, Store, F.getParent()); ++MustAliasCount; break; @@ -205,19 +205,19 @@ AliasResult AR = AA.alias(MemoryLocation::get(cast(*I1)), MemoryLocation::get(cast(*I2))); switch (AR) { - case NoAlias: + case AliasResult::NoAlias: PrintLoadStoreResults(AR, PrintNoAlias, *I1, *I2, F.getParent()); ++NoAliasCount; break; - case MayAlias: + case AliasResult::MayAlias: PrintLoadStoreResults(AR, PrintMayAlias, *I1, *I2, F.getParent()); ++MayAliasCount; break; - case PartialAlias: + case AliasResult::PartialAlias: PrintLoadStoreResults(AR, PrintPartialAlias, *I1, *I2, F.getParent()); ++PartialAliasCount; break; - case MustAlias: + case AliasResult::MustAlias: PrintLoadStoreResults(AR, PrintMustAlias, *I1, *I2, F.getParent()); ++MustAliasCount; break; diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -64,7 +64,7 @@ // If the pointers are not a must-alias pair, this set becomes a may alias. if (AA.alias(MemoryLocation(L->getValue(), L->getSize(), L->getAAInfo()), MemoryLocation(R->getValue(), R->getSize(), R->getAAInfo())) != - MustAlias) + AliasResult::MustAlias) Alias = SetMayAlias; } @@ -140,11 +140,11 @@ AliasResult Result = AA.alias( MemoryLocation(P->getValue(), P->getSize(), P->getAAInfo()), MemoryLocation(Entry.getValue(), Size, AAInfo)); - if (Result != MustAlias) { + if (Result != AliasResult::MustAlias) { Alias = SetMayAlias; AST.TotalMayAliasSetSize += size(); } - assert(Result != NoAlias && "Cannot be part of must set!"); + assert(Result != AliasResult::NoAlias && "Cannot be part of must set!"); } else if (!SkipSizeUpdate) P->updateSizeAndAAInfo(Size, AAInfo); } @@ -194,7 +194,7 @@ const AAMDNodes &AAInfo, AliasAnalysis &AA) const { if (AliasAny) - return MayAlias; + return AliasResult::MayAlias; if (Alias == SetMustAlias) { assert(UnknownInsts.empty() && "Illegal must alias set!"); @@ -210,11 +210,13 @@ // If this is a may-alias set, we have to check all of the pointers in the set // to be sure it doesn't alias the set... - for (iterator I = begin(), E = end(); I != E; ++I) - if (AliasResult AR = AA.alias( - MemoryLocation(Ptr, Size, AAInfo), - MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo()))) + for (iterator I = begin(), E = end(); I != E; ++I) { + AliasResult AR = + AA.alias(MemoryLocation(Ptr, Size, AAInfo), + MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo())); + if (AR != AliasResult::NoAlias) return AR; + } // Check the unknown instructions... if (!UnknownInsts.empty()) { @@ -222,10 +224,10 @@ if (auto *Inst = getUnknownInst(i)) if (isModOrRefSet( AA.getModRefInfo(Inst, MemoryLocation(Ptr, Size, AAInfo)))) - return MayAlias; + return AliasResult::MayAlias; } - return NoAlias; + return AliasResult::NoAlias; } bool AliasSet::aliasesUnknownInst(const Instruction *Inst, @@ -306,10 +308,10 @@ continue; AliasResult AR = AS.aliasesPointer(Ptr, Size, AAInfo, AA); - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) continue; - if (AR != MustAlias) + if (AR != AliasResult::MustAlias) MustAliasAll = false; if (!FoundSet) { diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -872,10 +872,10 @@ AliasResult AR = getBestAAResults().alias( MemoryLocation::getBeforeOrAfter(*CI), MemoryLocation::getBeforeOrAfter(Object), AAQI); - if (AR != MustAlias) + if (AR != AliasResult::MustAlias) IsMustAlias = false; // Operand doesn't alias 'Object', continue looking for other aliases - if (AR == NoAlias) + if (AR == AliasResult::NoAlias) continue; // Operand aliases 'Object', but call doesn't modify it. Strengthen // initial assumption and keep looking in case if there are more aliases. @@ -917,8 +917,8 @@ if (isMallocOrCallocLikeFn(Call, &TLI)) { // Be conservative if the accessed pointer may alias the allocation - // fallback to the generic handling below. - if (getBestAAResults().alias(MemoryLocation::getBeforeOrAfter(Call), - Loc, AAQI) == NoAlias) + if (getBestAAResults().alias(MemoryLocation::getBeforeOrAfter(Call), Loc, + AAQI) == AliasResult::NoAlias) return ModRefInfo::NoModRef; } @@ -932,9 +932,9 @@ getBestAAResults().alias(MemoryLocation::getForDest(Inst), Loc, AAQI); // It's also possible for Loc to alias both src and dest, or neither. ModRefInfo rv = ModRefInfo::NoModRef; - if (SrcAA != NoAlias) + if (SrcAA != AliasResult::NoAlias) rv = setRef(rv); - if (DestAA != NoAlias) + if (DestAA != AliasResult::NoAlias) rv = setMod(rv); return rv; } @@ -1053,7 +1053,7 @@ // compile-time constant. if (!DecompGEP1.HasCompileTimeConstantScale || !DecompGEP2.HasCompileTimeConstantScale) - return MayAlias; + return AliasResult::MayAlias; assert(DecompGEP1.Base == UnderlyingV1 && DecompGEP2.Base == UnderlyingV2 && "DecomposeGEPExpression returned a result different from " @@ -1069,19 +1069,19 @@ if (*DecompGEP1.InBounds && DecompGEP1.VarIndices.empty() && V2Size.hasValue() && DecompGEP1.Offset.sge(V2Size.getValue()) && isBaseOfObject(DecompGEP2.Base)) - return NoAlias; + return AliasResult::NoAlias; if (isa(V2)) { // Symmetric case to above. if (*DecompGEP2.InBounds && DecompGEP1.VarIndices.empty() && V1Size.hasValue() && DecompGEP1.Offset.sle(-V1Size.getValue()) && isBaseOfObject(DecompGEP1.Base)) - return NoAlias; + return AliasResult::NoAlias; } else { // TODO: This limitation exists for compile-time reasons. Relax it if we // can avoid exponential pathological cases. if (!V1Size.hasValue() && !V2Size.hasValue()) - return MayAlias; + return AliasResult::MayAlias; } // For GEPs with identical offsets, we can preserve the size and AAInfo @@ -1098,8 +1098,9 @@ // If we get a No or May, then return it immediately, no amount of analysis // will improve this situation. - if (BaseAlias != MustAlias) { - assert(BaseAlias == NoAlias || BaseAlias == MayAlias); + if (BaseAlias != AliasResult::MustAlias) { + assert(BaseAlias == AliasResult::NoAlias || + BaseAlias == AliasResult::MayAlias); return BaseAlias; } @@ -1142,9 +1143,9 @@ AAQI.setClobberOffset(LeftPtr, RightPtr, LSize, RSize, Off.getSExtValue()); } - return PartialAlias; + return AliasResult::PartialAlias; } - return NoAlias; + return AliasResult::NoAlias; } } @@ -1195,7 +1196,7 @@ if (V1Size.hasValue() && V2Size.hasValue() && ModOffset.uge(V2Size.getValue()) && (GCD - ModOffset).uge(V1Size.getValue())) - return NoAlias; + return AliasResult::NoAlias; // If we know all the variables are non-negative, then the total offset is // also non-negative and >= DecompGEP1.Offset. We have the following layout: @@ -1203,14 +1204,14 @@ // If DecompGEP1.Offset >= V2Size, the accesses don't alias. if (AllNonNegative && V2Size.hasValue() && DecompGEP1.Offset.uge(V2Size.getValue())) - return NoAlias; + return AliasResult::NoAlias; // Similarly, if the variables are non-positive, then the total offset is // also non-positive and <= DecompGEP1.Offset. We have the following layout: // [TotalOffset, TotalOffset+V1Size) ... [0, V2Size) // If -DecompGEP1.Offset >= V1Size, the accesses don't alias. if (AllNonPositive && V1Size.hasValue() && (-DecompGEP1.Offset).uge(V1Size.getValue())) - return NoAlias; + return AliasResult::NoAlias; if (V1Size.hasValue() && V2Size.hasValue()) { // Try to determine whether abs(VarIndex) > 0. @@ -1241,19 +1242,19 @@ // or higher both do not alias. if (OffsetLo.isNegative() && (-OffsetLo).uge(V1Size.getValue()) && OffsetHi.isNonNegative() && OffsetHi.uge(V2Size.getValue())) - return NoAlias; + return AliasResult::NoAlias; } } if (constantOffsetHeuristic(DecompGEP1.VarIndices, V1Size, V2Size, DecompGEP1.Offset, &AC, DT)) - return NoAlias; + return AliasResult::NoAlias; } // Statically, we can see that the base objects are the same, but the // pointers have dynamic offsets which we can't resolve. And none of our // little tricks above worked. - return MayAlias; + return AliasResult::MayAlias; } static AliasResult MergeAliasResults(AliasResult A, AliasResult B) { @@ -1261,11 +1262,11 @@ if (A == B) return A; // A mix of PartialAlias and MustAlias is PartialAlias. - if ((A == PartialAlias && B == MustAlias) || - (B == PartialAlias && A == MustAlias)) - return PartialAlias; + if ((A == AliasResult::PartialAlias && B == AliasResult::MustAlias) || + (B == AliasResult::PartialAlias && A == AliasResult::MustAlias)) + return AliasResult::PartialAlias; // Otherwise, we don't know anything. - return MayAlias; + return AliasResult::MayAlias; } /// Provides a bunch of ad-hoc rules to disambiguate a Select instruction @@ -1282,8 +1283,8 @@ AliasResult Alias = getBestAAResults().alias( MemoryLocation(SI->getTrueValue(), SISize, SIAAInfo), MemoryLocation(SI2->getTrueValue(), V2Size, V2AAInfo), AAQI); - if (Alias == MayAlias) - return MayAlias; + if (Alias == AliasResult::MayAlias) + return AliasResult::MayAlias; AliasResult ThisAlias = getBestAAResults().alias( MemoryLocation(SI->getFalseValue(), SISize, SIAAInfo), MemoryLocation(SI2->getFalseValue(), V2Size, V2AAInfo), AAQI); @@ -1295,8 +1296,8 @@ AliasResult Alias = getBestAAResults().alias( MemoryLocation(V2, V2Size, V2AAInfo), MemoryLocation(SI->getTrueValue(), SISize, SIAAInfo), AAQI); - if (Alias == MayAlias) - return MayAlias; + if (Alias == AliasResult::MayAlias) + return AliasResult::MayAlias; AliasResult ThisAlias = getBestAAResults().alias( MemoryLocation(V2, V2Size, V2AAInfo), @@ -1328,7 +1329,7 @@ *Alias = MergeAliasResults(*Alias, ThisAlias); else Alias = ThisAlias; - if (*Alias == MayAlias) + if (*Alias == AliasResult::MayAlias) break; } return *Alias; @@ -1357,7 +1358,7 @@ // is if both sides are PHI nodes. In which case, this is O(m x n) time // where 'm' and 'n' are the number of PHI sources. if (PhiValueSet.size() > MaxLookupSearchDepth) - return MayAlias; + return AliasResult::MayAlias; // Add the values to V1Srcs for (Value *PV1 : PhiValueSet) { if (CheckForRecPhi(PV1)) @@ -1377,7 +1378,7 @@ // that we handle the single phi case as that lets us handle LCSSA // phi nodes and (combined with the recursive phi handling) simple // pointer induction variable patterns. - return MayAlias; + return AliasResult::MayAlias; } OnePhi = PV1; } @@ -1392,14 +1393,14 @@ if (OnePhi && UniqueSrc.size() > 1) // Out of an abundance of caution, allow only the trivial lcssa and // recursive phi cases. - return MayAlias; + return AliasResult::MayAlias; } // If V1Srcs is empty then that means that the phi has no underlying non-phi // value. This should only be possible in blocks unreachable from the entry // block, but return MayAlias just in case. if (V1Srcs.empty()) - return MayAlias; + return AliasResult::MayAlias; // If this PHI node is recursive, indicate that the pointer may be moved // across iterations. We can only prove NoAlias if different underlying @@ -1428,12 +1429,12 @@ // Early exit if the check of the first PHI source against V2 is MayAlias. // Other results are not possible. - if (Alias == MayAlias) - return MayAlias; + if (Alias == AliasResult::MayAlias) + return AliasResult::MayAlias; // With recursive phis we cannot guarantee that MustAlias/PartialAlias will // remain valid to all elements and needs to conservatively return MayAlias. - if (isRecursive && Alias != NoAlias) - return MayAlias; + if (isRecursive && Alias != AliasResult::NoAlias) + return AliasResult::MayAlias; // If all sources of the PHI node NoAlias or MustAlias V2, then returns // NoAlias / MustAlias. Otherwise, returns MayAlias. @@ -1444,7 +1445,7 @@ MemoryLocation(V2, V2Size, V2AAInfo), MemoryLocation(V, PNSize, PNAAInfo), *UseAAQI); Alias = MergeAliasResults(ThisAlias, Alias); - if (Alias == MayAlias) + if (Alias == AliasResult::MayAlias) break; } @@ -1461,7 +1462,7 @@ // If either of the memory references is empty, it doesn't matter what the // pointer values are. if (V1Size.isZero() || V2Size.isZero()) - return NoAlias; + return AliasResult::NoAlias; // Strip off any casts if they exist. V1 = V1->stripPointerCastsForAliasAnalysis(); @@ -1470,7 +1471,7 @@ // If V1 or V2 is undef, the result is NoAlias because we can always pick a // value for undef that aliases nothing in the program. if (isa(V1) || isa(V2)) - return NoAlias; + return AliasResult::NoAlias; // Are we checking for alias of the same value? // Because we look 'through' phi nodes, we could look at "Value" pointers from @@ -1479,10 +1480,10 @@ // happen by looking at the visited phi nodes and making sure they cannot // reach the value. if (isValueEqualInPotentialCycles(V1, V2)) - return MustAlias; + return AliasResult::MustAlias; if (!V1->getType()->isPointerTy() || !V2->getType()->isPointerTy()) - return NoAlias; // Scalars cannot alias each other + return AliasResult::NoAlias; // Scalars cannot alias each other // Figure out what objects these things are pointing to if we can. const Value *O1 = getUnderlyingObject(V1, MaxLookupSearchDepth); @@ -1492,26 +1493,26 @@ // don't alias any other pointer. if (const ConstantPointerNull *CPN = dyn_cast(O1)) if (!NullPointerIsDefined(&F, CPN->getType()->getAddressSpace())) - return NoAlias; + return AliasResult::NoAlias; if (const ConstantPointerNull *CPN = dyn_cast(O2)) if (!NullPointerIsDefined(&F, CPN->getType()->getAddressSpace())) - return NoAlias; + return AliasResult::NoAlias; if (O1 != O2) { // If V1/V2 point to two different objects, we know that we have no alias. if (isIdentifiedObject(O1) && isIdentifiedObject(O2)) - return NoAlias; + return AliasResult::NoAlias; // Constant pointers can't alias with non-const isIdentifiedObject objects. if ((isa(O1) && isIdentifiedObject(O2) && !isa(O2)) || (isa(O2) && isIdentifiedObject(O1) && !isa(O1))) - return NoAlias; + return AliasResult::NoAlias; // Function arguments can't alias with things that are known to be // unambigously identified at the function level. if ((isa(O1) && isIdentifiedFunctionLocal(O2)) || (isa(O2) && isIdentifiedFunctionLocal(O1))) - return NoAlias; + return AliasResult::NoAlias; // If one pointer is the result of a call/invoke or load and the other is a // non-escaping local object within the same function, then we know the @@ -1524,10 +1525,10 @@ // nocapture value to other functions as long as they don't capture it. if (isEscapeSource(O1) && isNonEscapingLocalObject(O2, &AAQI.IsCapturedCache)) - return NoAlias; + return AliasResult::NoAlias; if (isEscapeSource(O2) && isNonEscapingLocalObject(O1, &AAQI.IsCapturedCache)) - return NoAlias; + return AliasResult::NoAlias; } // If the size of one access is larger than the entire object on the other @@ -1539,7 +1540,7 @@ (isObjectSmallerThan( O1, getMinimalExtentFrom(*V2, V2Size, DL, NullIsValidLocation), DL, TLI, NullIsValidLocation))) - return NoAlias; + return AliasResult::NoAlias; // If one the accesses may be before the accessed pointer, canonicalize this // by using unknown after-pointer sizes for both accesses. This is @@ -1558,7 +1559,7 @@ // enough to be very rarely hit, while still being small enough to avoid // stack overflows. if (AAQI.Depth >= 512) - return MayAlias; + return AliasResult::MayAlias; // Check the cache before climbing up use-def chains. This also terminates // otherwise infinitely recursive queries. @@ -1567,7 +1568,7 @@ if (V1 > V2) std::swap(Locs.first, Locs.second); const auto &Pair = AAQI.AliasCache.try_emplace( - Locs, AAQueryInfo::CacheEntry{NoAlias, 0}); + Locs, AAQueryInfo::CacheEntry{AliasResult::NoAlias, 0}); if (!Pair.second) { auto &Entry = Pair.first->second; if (!Entry.isDefinitive()) { @@ -1588,9 +1589,10 @@ auto &Entry = It->second; // Check whether a NoAlias assumption has been used, but disproven. - bool AssumptionDisproven = Entry.NumAssumptionUses > 0 && Result != NoAlias; + bool AssumptionDisproven = + Entry.NumAssumptionUses > 0 && Result != AliasResult::NoAlias; if (AssumptionDisproven) - Result = MayAlias; + Result = AliasResult::MayAlias; // This is a definitive result now, when considered as a root query. AAQI.NumAssumptionUses -= Entry.NumAssumptionUses; @@ -1606,7 +1608,8 @@ // The result may still be based on assumptions higher up in the chain. // Remember it, so it can be purged from the cache later. - if (OrigNumAssumptionUses != AAQI.NumAssumptionUses && Result != MayAlias) + if (OrigNumAssumptionUses != AAQI.NumAssumptionUses && + Result != AliasResult::MayAlias) AAQI.AssumptionBasedResults.push_back(Locs); return Result; } @@ -1618,36 +1621,36 @@ if (const GEPOperator *GV1 = dyn_cast(V1)) { AliasResult Result = aliasGEP(GV1, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, O1, O2, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } else if (const GEPOperator *GV2 = dyn_cast(V2)) { AliasResult Result = aliasGEP(GV2, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, O2, O1, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } if (const PHINode *PN = dyn_cast(V1)) { AliasResult Result = aliasPHI(PN, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } else if (const PHINode *PN = dyn_cast(V2)) { AliasResult Result = aliasPHI(PN, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } if (const SelectInst *S1 = dyn_cast(V1)) { AliasResult Result = aliasSelect(S1, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } else if (const SelectInst *S2 = dyn_cast(V2)) { AliasResult Result = aliasSelect(S2, V2Size, V2AAInfo, V1, V1Size, V1AAInfo, AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; } @@ -1658,10 +1661,10 @@ if (V1Size.isPrecise() && V2Size.isPrecise() && (isObjectSize(O1, V1Size.getValue(), DL, TLI, NullIsValidLocation) || isObjectSize(O2, V2Size.getValue(), DL, TLI, NullIsValidLocation))) - return PartialAlias; + return AliasResult::PartialAlias; } - return MayAlias; + return AliasResult::MayAlias; } /// Check whether two Values can be considered equivalent. diff --git a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp --- a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp +++ b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp @@ -850,7 +850,7 @@ auto *ValB = LocB.Ptr; if (!ValA->getType()->isPointerTy() || !ValB->getType()->isPointerTy()) - return NoAlias; + return AliasResult::NoAlias; auto *Fn = parentFunctionOfValue(ValA); if (!Fn) { @@ -861,7 +861,7 @@ LLVM_DEBUG( dbgs() << "CFLAndersAA: could not extract parent function information.\n"); - return MayAlias; + return AliasResult::MayAlias; } } else { assert(!parentFunctionOfValue(ValB) || parentFunctionOfValue(ValB) == Fn); @@ -872,15 +872,15 @@ // AliasMap lookup if (FunInfo->mayAlias(ValA, LocA.Size, ValB, LocB.Size)) - return MayAlias; - return NoAlias; + return AliasResult::MayAlias; + return AliasResult::NoAlias; } AliasResult CFLAndersAAResult::alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI) { if (LocA.Ptr == LocB.Ptr) - return MustAlias; + return AliasResult::MustAlias; // Comparisons between global variables and other constants should be // handled by BasicAA. @@ -891,7 +891,7 @@ return AAResultBase::alias(LocA, LocB, AAQI); AliasResult QueryResult = query(LocA, LocB); - if (QueryResult == MayAlias) + if (QueryResult == AliasResult::MayAlias) return AAResultBase::alias(LocA, LocB, AAQI); return QueryResult; diff --git a/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp b/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp --- a/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp +++ b/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp @@ -269,7 +269,7 @@ auto *ValB = const_cast(LocB.Ptr); if (!ValA->getType()->isPointerTy() || !ValB->getType()->isPointerTy()) - return NoAlias; + return AliasResult::NoAlias; Function *Fn = nullptr; Function *MaybeFnA = const_cast(parentFunctionOfValue(ValA)); @@ -280,7 +280,7 @@ LLVM_DEBUG( dbgs() << "CFLSteensAA: could not extract parent function information.\n"); - return MayAlias; + return AliasResult::MayAlias; } if (MaybeFnA) { @@ -298,11 +298,11 @@ auto &Sets = MaybeInfo->getStratifiedSets(); auto MaybeA = Sets.find(InstantiatedValue{ValA, 0}); if (!MaybeA.hasValue()) - return MayAlias; + return AliasResult::MayAlias; auto MaybeB = Sets.find(InstantiatedValue{ValB, 0}); if (!MaybeB.hasValue()) - return MayAlias; + return AliasResult::MayAlias; auto SetA = *MaybeA; auto SetB = *MaybeB; @@ -320,14 +320,14 @@ // - AttrEscaped do not alias globals/arguments, but they may alias // AttrUnknown values if (SetA.Index == SetB.Index) - return MayAlias; + return AliasResult::MayAlias; if (AttrsA.none() || AttrsB.none()) - return NoAlias; + return AliasResult::NoAlias; if (hasUnknownOrCallerAttr(AttrsA) || hasUnknownOrCallerAttr(AttrsB)) - return MayAlias; + return AliasResult::MayAlias; if (isGlobalOrArgAttr(AttrsA) && isGlobalOrArgAttr(AttrsB)) - return MayAlias; - return NoAlias; + return AliasResult::MayAlias; + return AliasResult::NoAlias; } AnalysisKey CFLSteensAA::Key; diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -657,8 +657,8 @@ MemoryLocation::getBeforeOrAfter(LocA.Ptr, LocA.AATags); MemoryLocation LocBS = MemoryLocation::getBeforeOrAfter(LocB.Ptr, LocB.AATags); - if (AA->alias(LocAS, LocBS) == NoAlias) - return NoAlias; + if (AA->alias(LocAS, LocBS) == AliasResult::NoAlias) + return AliasResult::NoAlias; // Check the underlying objects are the same const Value *AObj = getUnderlyingObject(LocA.Ptr); @@ -666,16 +666,16 @@ // If the underlying objects are the same, they must alias if (AObj == BObj) - return MustAlias; + return AliasResult::MustAlias; // We may have hit the recursion limit for underlying objects, or have // underlying objects where we don't know they will alias. if (!isIdentifiedObject(AObj) || !isIdentifiedObject(BObj)) - return MayAlias; + return AliasResult::MayAlias; // Otherwise we know the objects are different and both identified objects so // must not alias. - return NoAlias; + return AliasResult::NoAlias; } @@ -3501,16 +3501,16 @@ switch (underlyingObjectsAlias(AA, F->getParent()->getDataLayout(), MemoryLocation::get(Dst), MemoryLocation::get(Src))) { - case MayAlias: - case PartialAlias: + case AliasResult::MayAlias: + case AliasResult::PartialAlias: // cannot analyse objects if we don't understand their aliasing. LLVM_DEBUG(dbgs() << "can't analyze may or partial alias\n"); return std::make_unique(Src, Dst); - case NoAlias: + case AliasResult::NoAlias: // If the objects noalias, they are distinct, accesses are independent. LLVM_DEBUG(dbgs() << "no alias\n"); return nullptr; - case MustAlias: + case AliasResult::MustAlias: break; // The underlying objects alias; test accesses for dependence. } @@ -3914,9 +3914,9 @@ assert(isLoadOrStore(Dst)); Value *SrcPtr = getLoadStorePointerOperand(Src); Value *DstPtr = getLoadStorePointerOperand(Dst); - assert(underlyingObjectsAlias(AA, F->getParent()->getDataLayout(), - MemoryLocation::get(Dst), - MemoryLocation::get(Src)) == MustAlias); + assert(underlyingObjectsAlias( + AA, F->getParent()->getDataLayout(), MemoryLocation::get(Dst), + MemoryLocation::get(Src)) == AliasResult::MustAlias); // establish loop nesting levels establishNestingLevels(Src, Dst); diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -847,14 +847,14 @@ // If the two pointers are derived from two different non-addr-taken // globals we know these can't alias. if (GV1 && GV2 && GV1 != GV2) - return NoAlias; + return AliasResult::NoAlias; // If one is and the other isn't, it isn't strictly safe but we can fake // this result if necessary for performance. This does not appear to be // a common problem in practice. if (EnableUnsafeGlobalsModRefAliasResults) if ((GV1 || GV2) && GV1 != GV2) - return NoAlias; + return AliasResult::NoAlias; // Check for a special case where a non-escaping global can be used to // conclude no-alias. @@ -862,7 +862,7 @@ const GlobalValue *GV = GV1 ? GV1 : GV2; const Value *UV = GV1 ? UV2 : UV1; if (isNonEscapingGlobalNoAlias(GV, UV)) - return NoAlias; + return AliasResult::NoAlias; } // Otherwise if they are both derived from the same addr-taken global, we @@ -893,14 +893,14 @@ // use this to disambiguate the pointers. If the pointers are based on // different indirect globals they cannot alias. if (GV1 && GV2 && GV1 != GV2) - return NoAlias; + return AliasResult::NoAlias; // If one is based on an indirect global and the other isn't, it isn't // strictly safe but we can fake this result if necessary for performance. // This does not appear to be a common problem in practice. if (EnableUnsafeGlobalsModRefAliasResults) if ((GV1 || GV2) && GV1 != GV2) - return NoAlias; + return AliasResult::NoAlias; return AAResultBase::alias(LocA, LocB, AAQI); } @@ -925,7 +925,7 @@ !all_of(Objects, [&](const Value *V) { return this->alias(MemoryLocation::getBeforeOrAfter(V), MemoryLocation::getBeforeOrAfter(GV), - AAQI) == NoAlias; + AAQI) == AliasResult::NoAlias; })) return ConservativeResult; diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp --- a/llvm/lib/Analysis/Lint.cpp +++ b/llvm/lib/Analysis/Lint.cpp @@ -242,7 +242,8 @@ continue; if (AI != BI && (*BI)->getType()->isPointerTy()) { AliasResult Result = AA->alias(*AI, *BI); - Assert(Result != MustAlias && Result != PartialAlias, + Assert(Result != AliasResult::MustAlias && + Result != AliasResult::PartialAlias, "Unusual: noalias argument aliases another argument", &I); } } @@ -302,7 +303,7 @@ if (Len->getValue().isIntN(32)) Size = LocationSize::precise(Len->getValue().getZExtValue()); Assert(AA->alias(MCI->getSource(), Size, MCI->getDest(), Size) != - MustAlias, + AliasResult::MustAlias, "Undefined behavior: memcpy source and destination overlap", &I); break; } @@ -318,7 +319,8 @@ // isn't expressive enough for what we really want to do. Known partial // overlap is not distinguished from the case where nothing is known. const LocationSize LS = LocationSize::precise(Size); - Assert(AA->alias(MCII->getSource(), LS, MCII->getDest(), LS) != MustAlias, + Assert(AA->alias(MCII->getSource(), LS, MCII->getDest(), LS) != + AliasResult::MustAlias, "Undefined behavior: memcpy source and destination overlap", &I); break; } diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -465,9 +465,9 @@ MemoryLocation Loc; /*ModRefInfo MR =*/ GetLocation(II, Loc, TLI); AliasResult R = BatchAA.alias(Loc, MemLoc); - if (R == NoAlias) + if (R == AliasResult::NoAlias) continue; - if (R == MustAlias) + if (R == AliasResult::MustAlias) return MemDepResult::getDef(II); if (ID == Intrinsic::masked_load) continue; @@ -513,11 +513,11 @@ AliasResult R = BatchAA.alias(LoadLoc, MemLoc); if (isLoad) { - if (R == NoAlias) + if (R == AliasResult::NoAlias) continue; // Must aliased loads are defs of each other. - if (R == MustAlias) + if (R == AliasResult::MustAlias) return MemDepResult::getDef(Inst); #if 0 // FIXME: Temporarily disabled. GVN is cleverly rewriting loads @@ -527,7 +527,7 @@ // If we have a partial alias, then return this as a clobber for the // client to handle. - if (R == PartialAlias) + if (R == AliasResult::PartialAlias) return MemDepResult::getClobber(Inst); #endif @@ -537,7 +537,7 @@ } // Stores don't depend on other no-aliased accesses. - if (R == NoAlias) + if (R == AliasResult::NoAlias) continue; // Stores don't alias loads from read-only memory. @@ -583,9 +583,9 @@ // If we found a pointer, check if it could be the same as our pointer. AliasResult R = BatchAA.alias(StoreLoc, MemLoc); - if (R == NoAlias) + if (R == AliasResult::NoAlias) continue; - if (R == MustAlias) + if (R == AliasResult::MustAlias) return MemDepResult::getDef(Inst); if (isInvariantLoad) continue; diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -286,7 +286,7 @@ case Intrinsic::invariant_end: case Intrinsic::assume: case Intrinsic::experimental_noalias_scope_decl: - return {false, NoAlias}; + return {false, AliasResult::NoAlias}; case Intrinsic::dbg_addr: case Intrinsic::dbg_declare: case Intrinsic::dbg_label: @@ -299,16 +299,16 @@ if (auto *CB = dyn_cast_or_null(UseInst)) { ModRefInfo I = AA.getModRefInfo(DefInst, CB); - AR = isMustSet(I) ? MustAlias : MayAlias; + AR = isMustSet(I) ? AliasResult::MustAlias : AliasResult::MayAlias; return {isModOrRefSet(I), AR}; } if (auto *DefLoad = dyn_cast(DefInst)) if (auto *UseLoad = dyn_cast_or_null(UseInst)) - return {!areLoadsReorderable(UseLoad, DefLoad), MayAlias}; + return {!areLoadsReorderable(UseLoad, DefLoad), AliasResult::MayAlias}; ModRefInfo I = AA.getModRefInfo(DefInst, UseLoc); - AR = isMustSet(I) ? MustAlias : MayAlias; + AR = isMustSet(I) ? AliasResult::MustAlias : AliasResult::MayAlias; return {isModSet(I), AR}; } @@ -344,7 +344,7 @@ const Instruction *Inst = nullptr; // The MemoryAccess we actually got called with, used to test local domination const MemoryAccess *OriginalAccess = nullptr; - Optional AR = MayAlias; + Optional AR = AliasResult::MayAlias; bool SkipSelfAccess = false; UpwardsMemoryQuery() = default; @@ -570,14 +570,14 @@ for (MemoryAccess *Current : def_chain(Desc.Last)) { Desc.Last = Current; if (Current == StopAt || Current == SkipStopAt) - return {Current, false, MayAlias}; + return {Current, false, AliasResult::MayAlias}; if (auto *MD = dyn_cast(Current)) { if (MSSA.isLiveOnEntryDef(MD)) - return {MD, true, MustAlias}; + return {MD, true, AliasResult::MustAlias}; if (!--*UpwardWalkLimit) - return {Current, true, MayAlias}; + return {Current, true, AliasResult::MayAlias}; ClobberAlias CA = instructionClobbersQuery(MD, Desc.Loc, Query->Inst, AA); @@ -591,7 +591,7 @@ assert(isa(Desc.Last) && "Ended at a non-clobber that's not a phi?"); - return {Desc.Last, false, MayAlias}; + return {Desc.Last, false, AliasResult::MayAlias}; } void addSearches(MemoryPhi *Phi, SmallVectorImpl &PausedSearches, @@ -1409,7 +1409,7 @@ if (!LocInfo.LastKillValid) { LocInfo.LastKill = VersionStack.size() - 1; LocInfo.LastKillValid = true; - LocInfo.AR = MayAlias; + LocInfo.AR = AliasResult::MayAlias; } // At this point, we should have corrected last kill and LowerBound to be @@ -2491,8 +2491,8 @@ StartingAccess->setOptimized(OptimizedAccess); if (MSSA->isLiveOnEntryDef(OptimizedAccess)) StartingAccess->setOptimizedAccessType(None); - else if (Q.AR == MustAlias) - StartingAccess->setOptimizedAccessType(MustAlias); + else if (Q.AR == AliasResult::MustAlias) + StartingAccess->setOptimizedAccessType(AliasResult::MustAlias); } else OptimizedAccess = StartingAccess->getOptimized(); diff --git a/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp b/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp --- a/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp +++ b/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp @@ -49,7 +49,7 @@ AliasResult Result = AAResultBase::alias(MemoryLocation(SA, LocA.Size, LocA.AATags), MemoryLocation(SB, LocB.Size, LocB.AATags), AAQI); - if (Result != MayAlias) + if (Result != AliasResult::MayAlias) return Result; // If that failed, climb to the underlying object, including climbing through @@ -61,13 +61,13 @@ MemoryLocation::getBeforeOrAfter(UB), AAQI); // We can't use MustAlias or PartialAlias results here because // GetUnderlyingObjCPtr may return an offsetted pointer value. - if (Result == NoAlias) - return NoAlias; + if (Result == AliasResult::NoAlias) + return AliasResult::NoAlias; } // If that failed, fail. We don't need to chain here, since that's covered // by the earlier precise query. - return MayAlias; + return AliasResult::MayAlias; } bool ObjCARCAAResult::pointsToConstantMemory(const MemoryLocation &Loc, diff --git a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp --- a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp @@ -28,7 +28,7 @@ // pointer values are. This allows the code below to ignore this special // case. if (LocA.Size.isZero() || LocB.Size.isZero()) - return NoAlias; + return AliasResult::NoAlias; // This is SCEVAAResult. Get the SCEVs! const SCEV *AS = SE.getSCEV(const_cast(LocA.Ptr)); @@ -36,7 +36,7 @@ // If they evaluate to the same expression, it's a MustAlias. if (AS == BS) - return MustAlias; + return AliasResult::MustAlias; // If something is known about the difference between the two addresses, // see if it's enough to prove a NoAlias. @@ -58,7 +58,7 @@ // are non-zero, which is special-cased above. if (ASizeInt.ule(SE.getUnsignedRange(BA).getUnsignedMin()) && (-BSizeInt).uge(SE.getUnsignedRange(BA).getUnsignedMax())) - return NoAlias; + return AliasResult::NoAlias; // Folding the subtraction while preserving range information can be tricky // (because of INT_MIN, etc.); if the prior test failed, swap AS and BS @@ -72,7 +72,7 @@ // are non-zero, which is special-cased above. if (BSizeInt.ule(SE.getUnsignedRange(AB).getUnsignedMin()) && (-ASizeInt).uge(SE.getUnsignedRange(AB).getUnsignedMax())) - return NoAlias; + return AliasResult::NoAlias; } // If ScalarEvolution can find an underlying object, form a new query. @@ -89,8 +89,8 @@ BO ? LocationSize::beforeOrAfterPointer() : LocB.Size, BO ? AAMDNodes() : LocB.AATags), - AAQI) == NoAlias) - return NoAlias; + AAQI) == AliasResult::NoAlias) + return AliasResult::NoAlias; // Forward the query to the next analysis. return AAResultBase::alias(LocA, LocB, AAQI); diff --git a/llvm/lib/Analysis/ScopedNoAliasAA.cpp b/llvm/lib/Analysis/ScopedNoAliasAA.cpp --- a/llvm/lib/Analysis/ScopedNoAliasAA.cpp +++ b/llvm/lib/Analysis/ScopedNoAliasAA.cpp @@ -64,10 +64,10 @@ const MDNode *ANoAlias = LocA.AATags.NoAlias, *BNoAlias = LocB.AATags.NoAlias; if (!mayAliasInScopes(AScopes, BNoAlias)) - return NoAlias; + return AliasResult::NoAlias; if (!mayAliasInScopes(BScopes, ANoAlias)) - return NoAlias; + return AliasResult::NoAlias; // If they may alias, chain to the next AliasAnalysis. return AAResultBase::alias(LocA, LocB, AAQI); diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp --- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp +++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp @@ -379,7 +379,7 @@ return AAResultBase::alias(LocA, LocB, AAQI); // Otherwise return a definitive result. - return NoAlias; + return AliasResult::NoAlias; } bool TypeBasedAAResult::pointsToConstantMemory(const MemoryLocation &Loc, diff --git a/llvm/lib/CodeGen/DFAPacketizer.cpp b/llvm/lib/CodeGen/DFAPacketizer.cpp --- a/llvm/lib/CodeGen/DFAPacketizer.cpp +++ b/llvm/lib/CodeGen/DFAPacketizer.cpp @@ -295,7 +295,7 @@ MemoryLocation(Op2.getValue(), Overlapb, UseTBAA ? Op2.getAAInfo() : AAMDNodes())); - return AAResult != NoAlias; + return AAResult != AliasResult::NoAlias; } bool VLIWPacketizerList::alias(const MachineInstr &MI1, diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -356,7 +356,7 @@ llvm::AliasResult AAResult = AA->alias( MemoryLocation::getAfter(MMO1->getValue(), MMO1->getAAInfo()), MemoryLocation::getAfter(MMO2->getValue(), MMO2->getAAInfo())); - if (AAResult != NoAlias) + if (AAResult != llvm::AliasResult::NoAlias) return AR_MayAlias; } } diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1317,7 +1317,7 @@ MemoryLocation(ValB, OverlapB, UseTBAA ? MMOb->getAAInfo() : AAMDNodes())); - return (AAResult != NoAlias); + return (AAResult != AliasResult::NoAlias); } bool MachineInstr::mayAlias(AAResults *AA, const MachineInstr &Other, diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -817,7 +817,7 @@ MemoryLocation::getAfter(MMO1->getValue(), MMO1->getAAInfo()), MemoryLocation::getAfter(MMO2->getValue(), MMO2->getAAInfo())); - if (AAResult != NoAlias) { + if (AAResult != AliasResult::NoAlias) { SDep Dep(Load, SDep::Barrier); Dep.setLatency(1); SU.addPred(Dep); diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -22777,7 +22777,7 @@ UseTBAA ? MUC0.MMO->getAAInfo() : AAMDNodes()), MemoryLocation(MUC1.MMO->getValue(), Overlap1, UseTBAA ? MUC1.MMO->getAAInfo() : AAMDNodes())); - if (AAResult == NoAlias) + if (AAResult == AliasResult::NoAlias) return false; } diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp @@ -41,24 +41,28 @@ AU.setPreservesAll(); } -// These arrays are indexed by address space value enum elements 0 ... to 7 -static const AliasResult ASAliasRules[8][8] = { - /* Flat Global Region Group Constant Private Constant 32-bit Buffer Fat Ptr */ - /* Flat */ {MayAlias, MayAlias, NoAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias}, - /* Global */ {MayAlias, MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , MayAlias, MayAlias}, - /* Region */ {NoAlias, NoAlias , MayAlias, NoAlias , NoAlias, NoAlias , NoAlias, NoAlias}, - /* Group */ {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias , NoAlias , NoAlias}, - /* Constant */ {MayAlias, MayAlias, NoAlias, NoAlias , NoAlias , NoAlias , MayAlias, MayAlias}, - /* Private */ {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, NoAlias , NoAlias}, - /* Constant 32-bit */ {MayAlias, MayAlias, NoAlias, NoAlias , MayAlias, NoAlias , NoAlias , MayAlias}, - /* Buffer Fat Ptr */ {MayAlias, MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , MayAlias, MayAlias} -}; - static AliasResult getAliasResult(unsigned AS1, unsigned AS2) { static_assert(AMDGPUAS::MAX_AMDGPU_ADDRESS <= 7, "Addr space out of range"); if (AS1 > AMDGPUAS::MAX_AMDGPU_ADDRESS || AS2 > AMDGPUAS::MAX_AMDGPU_ADDRESS) - return MayAlias; + return AliasResult::MayAlias; + +#define ASMay AliasResult::MayAlias +#define ASNo AliasResult::NoAlias + // This array is indexed by address space value enum elements 0 ... to 7 + static const AliasResult ASAliasRules[8][8] = { + /* Flat Global Region Group Constant Private Const32 Buf Fat Ptr */ + /* Flat */ {ASMay, ASMay, ASNo, ASMay, ASMay, ASMay, ASMay, ASMay}, + /* Global */ {ASMay, ASMay, ASNo, ASNo, ASMay, ASNo, ASMay, ASMay}, + /* Region */ {ASNo, ASNo, ASMay, ASNo, ASNo, ASNo, ASNo, ASNo}, + /* Group */ {ASMay, ASNo, ASNo, ASMay, ASNo, ASNo, ASNo, ASNo}, + /* Constant */ {ASMay, ASMay, ASNo, ASNo, ASNo, ASNo, ASMay, ASMay}, + /* Private */ {ASMay, ASNo, ASNo, ASNo, ASNo, ASMay, ASNo, ASNo}, + /* Constant 32-bit */ {ASMay, ASMay, ASNo, ASNo, ASMay, ASNo, ASNo, ASMay}, + /* Buffer Fat Ptr */ {ASMay, ASMay, ASNo, ASNo, ASMay, ASNo, ASMay, ASMay} + }; +#undef ASMay +#undef ASNo return ASAliasRules[AS1][AS2]; } @@ -70,7 +74,7 @@ unsigned asB = LocB.Ptr->getType()->getPointerAddressSpace(); AliasResult Result = getAliasResult(asA, asB); - if (Result == NoAlias) + if (Result == AliasResult::NoAlias) return Result; // In general, FLAT (generic) pointers could be aliased to LOCAL or PRIVATE @@ -94,14 +98,14 @@ // prepared on the host side, where only GLOBAL or CONSTANT variables are // visible. Note that this even holds for regular functions. if (LI->getPointerAddressSpace() == AMDGPUAS::CONSTANT_ADDRESS) - return NoAlias; + return AliasResult::NoAlias; } else if (const Argument *Arg = dyn_cast(ObjA)) { const Function *F = Arg->getParent(); switch (F->getCallingConv()) { case CallingConv::AMDGPU_KERNEL: // In the kernel function, kernel arguments won't alias to (local) // variables in shared or private address space. - return NoAlias; + return AliasResult::NoAlias; default: // TODO: In the regular function, if that local variable in the // location B is not captured, that argument pointer won't alias to it diff --git a/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp b/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp --- a/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp +++ b/llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp @@ -180,7 +180,7 @@ return true; MemoryLocation SL(SMO.getValue(), SMO.getSize(), SMO.getAAInfo()); - if (AA->alias(L, SL)) + if (AA->alias(L, SL) != AliasResult::NoAlias) return true; } diff --git a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp --- a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp @@ -1432,8 +1432,9 @@ if (V1 == V2 && End1 == End2) return false; - return !AA->alias(MemoryLocation(V1, End1, Load->getAAInfo()), - MemoryLocation(V2, End2, Store->getAAInfo())); + return AA->alias(MemoryLocation(V1, End1, Load->getAAInfo()), + MemoryLocation(V2, End2, Store->getAAInfo())) == + AliasResult::NoAlias; } bool SystemZDAGToDAGISel::storeLoadCanUseMVC(SDNode *N) const { diff --git a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp --- a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp +++ b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp @@ -532,7 +532,7 @@ AliasResult AAResult = AA->alias(MemoryLocation(Op1.getValue(), Overlapa, Op1.getAAInfo()), MemoryLocation(Op2.getValue(), Overlapb, Op2.getAAInfo())); - return AAResult != NoAlias; + return AAResult != AliasResult::NoAlias; } void X86AvoidSFBPass::findPotentiallylBlockedCopies(MachineFunction &MF) { diff --git a/llvm/lib/Transforms/Coroutines/CoroElide.cpp b/llvm/lib/Transforms/Coroutines/CoroElide.cpp --- a/llvm/lib/Transforms/Coroutines/CoroElide.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroElide.cpp @@ -71,7 +71,7 @@ // See if any operand of the call instruction references the coroutine frame. static bool operandReferences(CallInst *CI, AllocaInst *Frame, AAResults &AA) { for (Value *Op : CI->operand_values()) - if (AA.alias(Op, Frame) != NoAlias) + if (AA.alias(Op, Frame) != AliasResult::NoAlias) return true; return false; } diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -2101,7 +2101,7 @@ Value *Arg = Call->getArgOperand(0); Value *EarlierArg = EarlierCall->getArgOperand(0); switch (PA.getAA()->alias(Arg, EarlierArg)) { - case MustAlias: + case AliasResult::MustAlias: Changed = true; // If the load has a builtin retain, insert a plain retain for it. if (Class == ARCInstKind::LoadWeakRetained) { @@ -2113,10 +2113,10 @@ Call->replaceAllUsesWith(EarlierCall); Call->eraseFromParent(); goto clobbered; - case MayAlias: - case PartialAlias: + case AliasResult::MayAlias: + case AliasResult::PartialAlias: goto clobbered; - case NoAlias: + case AliasResult::NoAlias: break; } break; @@ -2130,7 +2130,7 @@ Value *Arg = Call->getArgOperand(0); Value *EarlierArg = EarlierCall->getArgOperand(0); switch (PA.getAA()->alias(Arg, EarlierArg)) { - case MustAlias: + case AliasResult::MustAlias: Changed = true; // If the load has a builtin retain, insert a plain retain for it. if (Class == ARCInstKind::LoadWeakRetained) { @@ -2142,10 +2142,10 @@ Call->replaceAllUsesWith(EarlierCall->getArgOperand(1)); Call->eraseFromParent(); goto clobbered; - case MayAlias: - case PartialAlias: + case AliasResult::MayAlias: + case AliasResult::PartialAlias: goto clobbered; - case NoAlias: + case AliasResult::NoAlias: break; } break; diff --git a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp --- a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp @@ -112,12 +112,12 @@ bool ProvenanceAnalysis::relatedCheck(const Value *A, const Value *B) { // Ask regular AliasAnalysis, for a first approximation. switch (AA->alias(A, B)) { - case NoAlias: + case AliasResult::NoAlias: return false; - case MustAlias: - case PartialAlias: + case AliasResult::MustAlias: + case AliasResult::PartialAlias: return true; - case MayAlias: + case AliasResult::MayAlias: break; } diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -2303,8 +2303,8 @@ if (Optional Loc = MemoryLocation::getOrNone(I)) { llvm::erase_if(Sets, [&](const AliasSet *AS) { - return AS->aliasesPointer(Loc->Ptr, Loc->Size, Loc->AATags, *AA) - != NoAlias; + return AS->aliasesPointer(Loc->Ptr, Loc->Size, Loc->AATags, *AA) != + AliasResult::NoAlias; }); } else { llvm::erase_if(Sets, [&](const AliasSet *AS) { diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -1088,7 +1088,7 @@ MemoryLocation StoreLoc = MemoryLocation::get(Store); MemoryLocation LoadLoc = MemoryLocation::get(Load); - AliasResult LdAliased = AA->alias(LoadLoc, StoreLoc); + bool LdAliased = AA->alias(LoadLoc, StoreLoc) != AliasResult::NoAlias; // If we can statically determine noalias we're good. if (!LdAliased) diff --git a/llvm/lib/Transforms/Utils/FlattenCFG.cpp b/llvm/lib/Transforms/Utils/FlattenCFG.cpp --- a/llvm/lib/Transforms/Utils/FlattenCFG.cpp +++ b/llvm/lib/Transforms/Utils/FlattenCFG.cpp @@ -360,7 +360,7 @@ for (BasicBlock::iterator BI(PBI2), BE(PTI2); BI != BE; ++BI) { if (BI->mayReadFromMemory() || BI->mayWriteToMemory()) { // Check alias with Head2. - if (!AA || AA->alias(&*iter1, &*BI)) + if (!AA || AA->alias(&*iter1, &*BI) != AliasResult::NoAlias) return false; } } diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1896,7 +1896,7 @@ bool aliased = true; if (Loc1.Ptr && Loc2.Ptr && isSimple(Inst1) && isSimple(Inst2)) { // Do the alias check. - aliased = AA->alias(Loc1, Loc2); + aliased = AA->alias(Loc1, Loc2) != AliasResult::NoAlias; } // Store the result in the cache. result = aliased; diff --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp --- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp +++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp @@ -89,7 +89,7 @@ AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI) { CB(); - return MayAlias; + return AliasResult::MayAlias; } }; } @@ -247,19 +247,19 @@ MemoryLocation S2Loc(S2, LocationSize::precise(1)); auto &AA = getAAResults(*F); - EXPECT_EQ(NoAlias, AA.alias(A1Loc, A2Loc)); - EXPECT_EQ(MayAlias, AA.alias(PhiLoc, A1Loc)); - EXPECT_EQ(MayAlias, AA.alias(S1Loc, S2Loc)); + EXPECT_EQ(AliasResult::NoAlias, AA.alias(A1Loc, A2Loc)); + EXPECT_EQ(AliasResult::MayAlias, AA.alias(PhiLoc, A1Loc)); + EXPECT_EQ(AliasResult::MayAlias, AA.alias(S1Loc, S2Loc)); BatchAAResults BatchAA(AA); - EXPECT_EQ(NoAlias, BatchAA.alias(A1Loc, A2Loc)); - EXPECT_EQ(MayAlias, BatchAA.alias(PhiLoc, A1Loc)); - EXPECT_EQ(MayAlias, BatchAA.alias(S1Loc, S2Loc)); + EXPECT_EQ(AliasResult::NoAlias, BatchAA.alias(A1Loc, A2Loc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA.alias(PhiLoc, A1Loc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA.alias(S1Loc, S2Loc)); BatchAAResults BatchAA2(AA); - EXPECT_EQ(NoAlias, BatchAA2.alias(A1Loc, A2Loc)); - EXPECT_EQ(MayAlias, BatchAA2.alias(S1Loc, S2Loc)); - EXPECT_EQ(MayAlias, BatchAA2.alias(PhiLoc, A1Loc)); + EXPECT_EQ(AliasResult::NoAlias, BatchAA2.alias(A1Loc, A2Loc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA2.alias(S1Loc, S2Loc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA2.alias(PhiLoc, A1Loc)); } TEST_F(AliasAnalysisTest, BatchAAPhiAssumption) { @@ -290,12 +290,12 @@ MemoryLocation BNextLoc(BNext, LocationSize::precise(1)); auto &AA = getAAResults(*F); - EXPECT_EQ(MayAlias, AA.alias(ALoc, BLoc)); - EXPECT_EQ(MayAlias, AA.alias(ANextLoc, BNextLoc)); + EXPECT_EQ(AliasResult::MayAlias, AA.alias(ALoc, BLoc)); + EXPECT_EQ(AliasResult::MayAlias, AA.alias(ANextLoc, BNextLoc)); BatchAAResults BatchAA(AA); - EXPECT_EQ(MayAlias, BatchAA.alias(ALoc, BLoc)); - EXPECT_EQ(MayAlias, BatchAA.alias(ANextLoc, BNextLoc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA.alias(ALoc, BLoc)); + EXPECT_EQ(AliasResult::MayAlias, BatchAA.alias(ANextLoc, BNextLoc)); } // Check that two aliased GEPs with non-constant offsets are correctly @@ -329,7 +329,7 @@ auto &AA = getAAResults(*F); BatchAAResults BatchAA(AA, /*CacheOffsets =*/true); - EXPECT_EQ(PartialAlias, BatchAA.alias(Loc1, Loc2)); + EXPECT_EQ(AliasResult::PartialAlias, BatchAA.alias(Loc1, Loc2)); EXPECT_EQ(-4, BatchAA.getClobberOffset(Loc1, Loc2).getValueOr(0)); EXPECT_EQ(4, BatchAA.getClobberOffset(Loc2, Loc1).getValueOr(0)); diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp --- a/llvm/unittests/Analysis/MemorySSATest.cpp +++ b/llvm/unittests/Analysis/MemorySSATest.cpp @@ -1036,7 +1036,7 @@ } for (LoadInst *V : {LA3, LA4}) { MemoryUse *MemUse = dyn_cast_or_null(MSSA.getMemoryAccess(V)); - EXPECT_EQ(MemUse->getOptimizedAccessType(), MustAlias) + EXPECT_EQ(MemUse->getOptimizedAccessType(), AliasResult::MustAlias) << "Load " << I << " doesn't have the correct alias information"; // EXPECT_EQ expands such that if we increment I above, it won't get // incremented except when we try to print the error message. @@ -1085,7 +1085,7 @@ EXPECT_EQ(MemDef->getOptimizedAccessType(), None) << "Store " << I << " doesn't have the correct alias information"; else - EXPECT_EQ(MemDef->getOptimizedAccessType(), MustAlias) + EXPECT_EQ(MemDef->getOptimizedAccessType(), AliasResult::MustAlias) << "Store " << I << " doesn't have the correct alias information"; // EXPECT_EQ expands such that if we increment I above, it won't get // incremented except when we try to print the error message. @@ -1119,7 +1119,7 @@ unsigned I = 0; for (LoadInst *V : {LA1, LB1}) { MemoryUse *MemUse = dyn_cast_or_null(MSSA.getMemoryAccess(V)); - EXPECT_EQ(MemUse->getOptimizedAccessType(), MayAlias) + EXPECT_EQ(MemUse->getOptimizedAccessType(), AliasResult::MayAlias) << "Load " << I << " doesn't have the correct alias information"; // EXPECT_EQ expands such that if we increment I above, it won't get // incremented except when we try to print the error message. @@ -1127,7 +1127,7 @@ } for (LoadInst *V : {LA2, LB2}) { MemoryUse *MemUse = dyn_cast_or_null(MSSA.getMemoryAccess(V)); - EXPECT_EQ(MemUse->getOptimizedAccessType(), MustAlias) + EXPECT_EQ(MemUse->getOptimizedAccessType(), AliasResult::MustAlias) << "Load " << I << " doesn't have the correct alias information"; // EXPECT_EQ expands such that if we increment I above, it won't get // incremented except when we try to print the error message. @@ -1187,13 +1187,13 @@ EXPECT_EQ(MemDef->isOptimized(), true) << "Store " << I << " was not optimized"; if (I == 1 || I == 3 || I == 4) - EXPECT_EQ(MemDef->getOptimizedAccessType(), MayAlias) + EXPECT_EQ(MemDef->getOptimizedAccessType(), AliasResult::MayAlias) << "Store " << I << " doesn't have the correct alias information"; else if (I == 0 || I == 2) EXPECT_EQ(MemDef->getOptimizedAccessType(), None) << "Store " << I << " doesn't have the correct alias information"; else - EXPECT_EQ(MemDef->getOptimizedAccessType(), MustAlias) + EXPECT_EQ(MemDef->getOptimizedAccessType(), AliasResult::MustAlias) << "Store " << I << " doesn't have the correct alias information"; // EXPECT_EQ expands such that if we increment I above, it won't get // incremented except when we try to print the error message.