diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/AliasSetTracker.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 39 | ||||
-rw-r--r-- | llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Analysis/DependenceAnalysis.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/MemoryLocation.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/ImplicitNullChecks.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMParallelDSP.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 2 |
12 files changed, 43 insertions, 44 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 0d0277e9c34..66544c51446 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -649,7 +649,7 @@ void AliasSet::print(raw_ostream &OS) const { for (iterator I = begin(), E = end(); I != E; ++I) { if (I != begin()) OS << ", "; I.getPointer()->printAsOperand(OS << "("); - if (I.getSize() == MemoryLocation::UnknownSize) + if (I.getSize() == LocationSize::unknown()) OS << ", unknown)"; else OS << ", " << I.getSize() << ")"; diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 2f513004fe8..b7aa395ab84 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1019,8 +1019,8 @@ static AliasResult aliasSameBasePointerGEPs(const GEPOperator *GEP1, // If we don't know the size of the accesses through both GEPs, we can't // determine whether the struct fields accessed can't alias. - if (MaybeV1Size == MemoryLocation::UnknownSize || - MaybeV2Size == MemoryLocation::UnknownSize) + if (MaybeV1Size == LocationSize::unknown() || + MaybeV2Size == LocationSize::unknown()) return MayAlias; const uint64_t V1Size = MaybeV1Size.getValue(); @@ -1184,8 +1184,7 @@ bool BasicAAResult::isGEPBaseAtNegativeOffset(const GEPOperator *GEPOp, const DecomposedGEP &DecompGEP, const DecomposedGEP &DecompObject, LocationSize MaybeObjectAccessSize) { // If the object access size is unknown, or the GEP isn't inbounds, bail. - if (MaybeObjectAccessSize == MemoryLocation::UnknownSize || - !GEPOp->isInBounds()) + if (MaybeObjectAccessSize == LocationSize::unknown() || !GEPOp->isInBounds()) return false; const uint64_t ObjectAccessSize = MaybeObjectAccessSize.getValue(); @@ -1254,8 +1253,8 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, return NoAlias; // Do the base pointers alias? AliasResult BaseAlias = - aliasCheck(UnderlyingV1, MemoryLocation::UnknownSize, AAMDNodes(), - UnderlyingV2, MemoryLocation::UnknownSize, AAMDNodes()); + aliasCheck(UnderlyingV1, LocationSize::unknown(), AAMDNodes(), + UnderlyingV2, LocationSize::unknown(), AAMDNodes()); // Check for geps of non-aliasing underlying pointers where the offsets are // identical. @@ -1314,13 +1313,12 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, // pointer, we know they cannot alias. // If both accesses are unknown size, we can't do anything useful here. - if (V1Size == MemoryLocation::UnknownSize && - V2Size == MemoryLocation::UnknownSize) + if (V1Size == LocationSize::unknown() && V2Size == LocationSize::unknown()) return MayAlias; - AliasResult R = aliasCheck(UnderlyingV1, MemoryLocation::UnknownSize, - AAMDNodes(), V2, MemoryLocation::UnknownSize, - V2AAInfo, nullptr, UnderlyingV2); + AliasResult R = + aliasCheck(UnderlyingV1, LocationSize::unknown(), AAMDNodes(), V2, + LocationSize::unknown(), V2AAInfo, nullptr, UnderlyingV2); 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 @@ -1351,7 +1349,7 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, // greater, we know they do not overlap. if (GEP1BaseOffset != 0 && DecompGEP1.VarIndices.empty()) { if (GEP1BaseOffset >= 0) { - if (V2Size != MemoryLocation::UnknownSize) { + if (V2Size != LocationSize::unknown()) { if ((uint64_t)GEP1BaseOffset < V2Size.getValue()) return PartialAlias; return NoAlias; @@ -1365,8 +1363,8 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, // GEP1 V2 // We need to know that V2Size is not unknown, otherwise we might have // stripped a gep with negative index ('gep <ptr>, -1, ...). - if (V1Size != MemoryLocation::UnknownSize && - V2Size != MemoryLocation::UnknownSize) { + if (V1Size != LocationSize::unknown() && + V2Size != LocationSize::unknown()) { if (-(uint64_t)GEP1BaseOffset < V1Size.getValue()) return PartialAlias; return NoAlias; @@ -1416,9 +1414,8 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, // mod Modulo. Check whether that difference guarantees that the // two locations do not alias. uint64_t ModOffset = (uint64_t)GEP1BaseOffset & (Modulo - 1); - if (V1Size != MemoryLocation::UnknownSize && - V2Size != MemoryLocation::UnknownSize && - ModOffset >= V2Size.getValue() && + if (V1Size != LocationSize::unknown() && + V2Size != LocationSize::unknown() && ModOffset >= V2Size.getValue() && V1Size.getValue() <= Modulo - ModOffset) return NoAlias; @@ -1426,7 +1423,7 @@ BasicAAResult::aliasGEP(const GEPOperator *GEP1, LocationSize V1Size, // If GEP1BasePtr > V2 (GEP1BaseOffset > 0) then we know the pointers // don't alias if V2Size can fit in the gap between V2 and GEP1BasePtr. if (AllPositive && GEP1BaseOffset > 0 && - V2Size != MemoryLocation::UnknownSize && + V2Size != LocationSize::unknown() && V2Size.getValue() <= (uint64_t)GEP1BaseOffset) return NoAlias; @@ -1607,7 +1604,7 @@ AliasResult BasicAAResult::aliasPHI(const PHINode *PN, LocationSize PNSize, // unknown to represent all the possible values the GEP could advance the // pointer to. if (isRecursive) - PNSize = MemoryLocation::UnknownSize; + PNSize = LocationSize::unknown(); AliasResult Alias = aliasCheck(V2, V2Size, V2AAInfo, V1Srcs[0], @@ -1864,8 +1861,8 @@ bool BasicAAResult::constantOffsetHeuristic( const SmallVectorImpl<VariableGEPIndex> &VarIndices, LocationSize MaybeV1Size, LocationSize MaybeV2Size, int64_t BaseOffset, AssumptionCache *AC, DominatorTree *DT) { - if (VarIndices.size() != 2 || MaybeV1Size == MemoryLocation::UnknownSize || - MaybeV2Size == MemoryLocation::UnknownSize) + if (VarIndices.size() != 2 || MaybeV1Size == LocationSize::unknown() || + MaybeV2Size == LocationSize::unknown()) return false; const uint64_t V1Size = MaybeV1Size.getValue(); diff --git a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp index b43b48eeef7..1c61dd369a0 100644 --- a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp +++ b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp @@ -556,9 +556,9 @@ bool CFLAndersAAResult::FunctionInfo::mayAlias( OffsetValue{RHS, 0}, Comparator); if (RangePair.first != RangePair.second) { - // Be conservative about UnknownSize - if (MaybeLHSSize == MemoryLocation::UnknownSize || - MaybeRHSSize == MemoryLocation::UnknownSize) + // Be conservative about unknown sizes + if (MaybeLHSSize == LocationSize::unknown() || + MaybeRHSSize == LocationSize::unknown()) return true; const uint64_t LHSSize = MaybeLHSSize.getValue(); diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 79c2728d562..b544ae5f535 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -633,8 +633,8 @@ static AliasResult underlyingObjectsAlias(AliasAnalysis *AA, const MemoryLocation &LocB) { // Check the original locations (minus size) for noalias, which can happen for // tbaa, incompatible underlying object locations, etc. - MemoryLocation LocAS(LocA.Ptr, MemoryLocation::UnknownSize, LocA.AATags); - MemoryLocation LocBS(LocB.Ptr, MemoryLocation::UnknownSize, LocB.AATags); + MemoryLocation LocAS(LocA.Ptr, LocationSize::unknown(), LocA.AATags); + MemoryLocation LocBS(LocB.Ptr, LocationSize::unknown(), LocB.AATags); if (AA->alias(LocAS, LocBS) == NoAlias) return NoAlias; diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 8312a0d1cff..b43e290956d 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -509,7 +509,7 @@ public: /// Register a load and whether it is only read from. void addLoad(MemoryLocation &Loc, bool IsReadOnly) { Value *Ptr = const_cast<Value*>(Loc.Ptr); - AST.add(Ptr, MemoryLocation::UnknownSize, Loc.AATags); + AST.add(Ptr, LocationSize::unknown(), Loc.AATags); Accesses.insert(MemAccessInfo(Ptr, false)); if (IsReadOnly) ReadOnlyPtr.insert(Ptr); @@ -518,7 +518,7 @@ public: /// Register a store. void addStore(MemoryLocation &Loc) { Value *Ptr = const_cast<Value*>(Loc.Ptr); - AST.add(Ptr, MemoryLocation::UnknownSize, Loc.AATags); + AST.add(Ptr, LocationSize::unknown(), Loc.AATags); Accesses.insert(MemAccessInfo(Ptr, true)); } diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp index 3cd4b4475ef..c0605f6ad37 100644 --- a/llvm/lib/Analysis/MemoryLocation.cpp +++ b/llvm/lib/Analysis/MemoryLocation.cpp @@ -55,7 +55,8 @@ MemoryLocation MemoryLocation::get(const VAArgInst *VI) { AAMDNodes AATags; VI->getAAMetadata(AATags); - return MemoryLocation(VI->getPointerOperand(), UnknownSize, AATags); + return MemoryLocation(VI->getPointerOperand(), LocationSize::unknown(), + AATags); } MemoryLocation MemoryLocation::get(const AtomicCmpXchgInst *CXI) { @@ -87,7 +88,7 @@ MemoryLocation MemoryLocation::getForSource(const AtomicMemTransferInst *MTI) { } MemoryLocation MemoryLocation::getForSource(const AnyMemTransferInst *MTI) { - uint64_t Size = UnknownSize; + uint64_t Size = MemoryLocation::UnknownSize; if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength())) Size = C->getValue().getZExtValue(); @@ -108,7 +109,7 @@ MemoryLocation MemoryLocation::getForDest(const AtomicMemIntrinsic *MI) { } MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) { - uint64_t Size = UnknownSize; + uint64_t Size = MemoryLocation::UnknownSize; if (ConstantInt *C = dyn_cast<ConstantInt>(MI->getLength())) Size = C->getValue().getZExtValue(); @@ -189,5 +190,6 @@ MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS, } // FIXME: Handle memset_pattern4 and memset_pattern8 also. - return MemoryLocation(CS.getArgument(ArgIdx), UnknownSize, AATags); + return MemoryLocation(CS.getArgument(ArgIdx), LocationSize::unknown(), + AATags); } diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp index 034692de92d..deb49a1ea48 100644 --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -344,11 +344,11 @@ ImplicitNullChecks::areMemoryOpsAliased(MachineInstr &MI, return AR_MayAlias; continue; } - llvm::AliasResult AAResult = AA->alias( - MemoryLocation(MMO1->getValue(), MemoryLocation::UnknownSize, - MMO1->getAAInfo()), - MemoryLocation(MMO2->getValue(), MemoryLocation::UnknownSize, - MMO2->getAAInfo())); + llvm::AliasResult AAResult = + AA->alias(MemoryLocation(MMO1->getValue(), LocationSize::unknown(), + MMO1->getAAInfo()), + MemoryLocation(MMO2->getValue(), LocationSize::unknown(), + MMO2->getAAInfo())); if (AAResult != NoAlias) return AR_MayAlias; } diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 5f6f0cf96a5..3d8510f7c0c 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1136,9 +1136,9 @@ void SwingSchedulerDAG::addLoopCarriedDependences(AliasAnalysis *AA) { continue; } AliasResult AAResult = AA->alias( - MemoryLocation(MMO1->getValue(), MemoryLocation::UnknownSize, + MemoryLocation(MMO1->getValue(), LocationSize::unknown(), MMO1->getAAInfo()), - MemoryLocation(MMO2->getValue(), MemoryLocation::UnknownSize, + MemoryLocation(MMO2->getValue(), LocationSize::unknown(), MMO2->getAAInfo())); if (AAResult != NoAlias) { diff --git a/llvm/lib/Target/ARM/ARMParallelDSP.cpp b/llvm/lib/Target/ARM/ARMParallelDSP.cpp index 050a76413cf..3ab9298c110 100644 --- a/llvm/lib/Target/ARM/ARMParallelDSP.cpp +++ b/llvm/lib/Target/ARM/ARMParallelDSP.cpp @@ -71,7 +71,7 @@ namespace { virtual ~OpChain() = default; void SetMemoryLocations() { - const auto Size = MemoryLocation::UnknownSize; + const auto Size = LocationSize::unknown(); for (auto *V : AllValues) { if (auto *I = dyn_cast<Instruction>(V)) { if (I->mayWriteToMemory()) diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp index f9ed0390923..f38992bef69 100644 --- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp +++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp @@ -1970,7 +1970,7 @@ mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L, // Get the location that may be stored across the loop. Since the access // is strided positively through memory, we say that the modified location // starts at the pointer and has infinite size. - LocationSize AccessSize = MemoryLocation::UnknownSize; + LocationSize AccessSize = LocationSize::unknown(); // If the loop iterates a fixed number of times, we can refine the access // size to be exactly the size of the memset, which is (BECount+1)*StoreSize diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 72c850fca99..f01c6a4e99b 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -165,7 +165,7 @@ static MemoryAccessKind checkFunctionMemoryAccess(Function &F, bool ThisBody, AAMDNodes AAInfo; I->getAAMetadata(AAInfo); - MemoryLocation Loc(Arg, MemoryLocation::UnknownSize, AAInfo); + MemoryLocation Loc(Arg, LocationSize::unknown(), AAInfo); // Skip accesses to local or constant memory as they don't impact the // externally visible mod/ref behavior. diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index bb918cf717d..601d49fc03f 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -693,7 +693,7 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT, for (Value *Op : CI->arg_operands()) if (Op->getType()->isPointerTy() && pointerInvalidatedByLoop( - MemoryLocation(Op, MemoryLocation::UnknownSize, AAMDNodes()), + MemoryLocation(Op, LocationSize::unknown(), AAMDNodes()), CurAST, CurLoop, AA)) return false; return true; |