From 1db839e73471a40309c2c10873b67c3b5b1b7a7b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 19 Oct 2010 21:06:16 +0000 Subject: [PATCH] Revert r116831 and r116839, which are breaking selfhost builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116858 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/AliasAnalysis.h | 34 ++++++------- include/llvm/Analysis/AliasSetTracker.h | 26 +++++----- lib/Analysis/AliasAnalysis.cpp | 2 +- lib/Analysis/AliasAnalysisEvaluator.cpp | 6 +-- lib/Analysis/AliasSetTracker.cpp | 18 +++---- lib/Analysis/BasicAliasAnalysis.cpp | 50 +++++++++---------- lib/Analysis/Lint.cpp | 6 +-- .../Scalar/DeadStoreElimination.cpp | 6 +-- lib/Transforms/Scalar/MemCpyOptimizer.cpp | 2 +- 9 files changed, 74 insertions(+), 76 deletions(-) diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index 8fd6d2fc2c3..9b9a9e2ccb6 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -67,7 +67,7 @@ public: /// UnknownSize - This is a special value which can be used with the /// size arguments in alias queries to indicate that the caller does not /// know the sizes of the potential memory references. - static uint64_t const UnknownSize = ~UINT64_C(0); + static unsigned const UnknownSize = ~0u; /// getTargetData - Return a pointer to the current TargetData object, or /// null if no TargetData object is available. @@ -77,7 +77,7 @@ public: /// getTypeStoreSize - Return the TargetData store size for the given type, /// if known, or a conservative value otherwise. /// - uint64_t getTypeStoreSize(const Type *Ty); + unsigned getTypeStoreSize(const Type *Ty); //===--------------------------------------------------------------------===// /// Alias Queries... @@ -88,13 +88,13 @@ public: /// Ptr - The address of the start of the location. const Value *Ptr; /// Size - The size of the location. - uint64_t Size; + unsigned Size; /// TBAATag - The metadata node which describes the TBAA type of /// the location, or null if there is no (unique) tag. const MDNode *TBAATag; explicit Location(const Value *P = 0, - uint64_t S = UnknownSize, + unsigned S = UnknownSize, const MDNode *N = 0) : Ptr(P), Size(S), TBAATag(N) {} @@ -129,8 +129,8 @@ public: virtual AliasResult alias(const Location &LocA, const Location &LocB); /// alias - A convenience wrapper. - AliasResult alias(const Value *V1, uint64_t V1Size, - const Value *V2, uint64_t V2Size) { + AliasResult alias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size) { return alias(Location(V1, V1Size), Location(V2, V2Size)); } @@ -146,8 +146,8 @@ public: } /// isNoAlias - A convenience wrapper. - bool isNoAlias(const Value *V1, uint64_t V1Size, - const Value *V2, uint64_t V2Size) { + bool isNoAlias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size) { return isNoAlias(Location(V1, V1Size), Location(V2, V2Size)); } @@ -278,7 +278,7 @@ public: /// getModRefInfo - A convenience wrapper. ModRefResult getModRefInfo(const Instruction *I, - const Value *P, uint64_t Size) { + const Value *P, unsigned Size) { return getModRefInfo(I, Location(P, Size)); } @@ -289,7 +289,7 @@ public: /// getModRefInfo (for call sites) - A convenience wrapper. ModRefResult getModRefInfo(ImmutableCallSite CS, - const Value *P, uint64_t Size) { + const Value *P, unsigned Size) { return getModRefInfo(CS, Location(P, Size)); } @@ -300,7 +300,7 @@ public: } /// getModRefInfo (for calls) - A convenience wrapper. - ModRefResult getModRefInfo(const CallInst *C, const Value *P, uint64_t Size) { + ModRefResult getModRefInfo(const CallInst *C, const Value *P, unsigned Size) { return getModRefInfo(C, Location(P, Size)); } @@ -313,7 +313,7 @@ public: /// getModRefInfo (for invokes) - A convenience wrapper. ModRefResult getModRefInfo(const InvokeInst *I, - const Value *P, uint64_t Size) { + const Value *P, unsigned Size) { return getModRefInfo(I, Location(P, Size)); } @@ -322,7 +322,7 @@ public: ModRefResult getModRefInfo(const LoadInst *L, const Location &Loc); /// getModRefInfo (for loads) - A convenience wrapper. - ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size) { + ModRefResult getModRefInfo(const LoadInst *L, const Value *P, unsigned Size) { return getModRefInfo(L, Location(P, Size)); } @@ -331,7 +331,7 @@ public: ModRefResult getModRefInfo(const StoreInst *S, const Location &Loc); /// getModRefInfo (for stores) - A convenience wrapper. - ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size) { + ModRefResult getModRefInfo(const StoreInst *S, const Value *P, unsigned Size) { return getModRefInfo(S, Location(P, Size)); } @@ -340,7 +340,7 @@ public: ModRefResult getModRefInfo(const VAArgInst* I, const Location &Loc); /// getModRefInfo (for va_args) - A convenience wrapper. - ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, uint64_t Size) { + ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, unsigned Size) { return getModRefInfo(I, Location(P, Size)); } @@ -360,7 +360,7 @@ public: bool canBasicBlockModify(const BasicBlock &BB, const Location &Loc); /// canBasicBlockModify - A convenience wrapper. - bool canBasicBlockModify(const BasicBlock &BB, const Value *P, uint64_t Size){ + bool canBasicBlockModify(const BasicBlock &BB, const Value *P, unsigned Size){ return canBasicBlockModify(BB, Location(P, Size)); } @@ -373,7 +373,7 @@ public: /// canInstructionRangeModify - A convenience wrapper. bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, - const Value *Ptr, uint64_t Size) { + const Value *Ptr, unsigned Size) { return canInstructionRangeModify(I1, I2, Location(Ptr, Size)); } diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index e844d10dda0..f66b3b70e2b 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -40,7 +40,7 @@ class AliasSet : public ilist_node { Value *Val; // The pointer this record corresponds to. PointerRec **PrevInList, *NextInList; AliasSet *AS; - uint64_t Size; + unsigned Size; const MDNode *TBAAInfo; public: PointerRec(Value *V) @@ -57,7 +57,7 @@ class AliasSet : public ilist_node { return &NextInList; } - void updateSizeAndTBAAInfo(uint64_t NewSize, const MDNode *NewTBAAInfo) { + void updateSizeAndTBAAInfo(unsigned NewSize, const MDNode *NewTBAAInfo) { if (NewSize > Size) Size = NewSize; if (TBAAInfo == DenseMapInfo::getEmptyKey()) @@ -68,7 +68,7 @@ class AliasSet : public ilist_node { TBAAInfo = DenseMapInfo::getTombstoneKey(); } - uint64_t getSize() const { return Size; } + unsigned getSize() const { return Size; } /// getTBAAInfo - Return the TBAAInfo, or null if there is no /// information or conflicting information. @@ -205,7 +205,7 @@ public: value_type *operator->() const { return &operator*(); } Value *getPointer() const { return CurNode->getValue(); } - uint64_t getSize() const { return CurNode->getSize(); } + unsigned getSize() const { return CurNode->getSize(); } const MDNode *getTBAAInfo() const { return CurNode->getTBAAInfo(); } iterator& operator++() { // Preincrement @@ -250,7 +250,7 @@ private: void removeFromTracker(AliasSetTracker &AST); - void addPointer(AliasSetTracker &AST, PointerRec &Entry, uint64_t Size, + void addPointer(AliasSetTracker &AST, PointerRec &Entry, unsigned Size, const MDNode *TBAAInfo, bool KnownMustAlias = false); void addCallSite(CallSite CS, AliasAnalysis &AA); @@ -266,7 +266,7 @@ private: /// aliasesPointer - Return true if the specified pointer "may" (or must) /// alias one of the members in the set. /// - bool aliasesPointer(const Value *Ptr, uint64_t Size, const MDNode *TBAAInfo, + bool aliasesPointer(const Value *Ptr, unsigned Size, const MDNode *TBAAInfo, AliasAnalysis &AA) const; bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; }; @@ -320,7 +320,7 @@ public: /// These methods return true if inserting the instruction resulted in the /// addition of a new alias set (i.e., the pointer did not alias anything). /// - bool add(Value *Ptr, uint64_t Size, const MDNode *TBAAInfo); // Add a location + bool add(Value *Ptr, unsigned Size, const MDNode *TBAAInfo); // Add a location bool add(LoadInst *LI); bool add(StoreInst *SI); bool add(VAArgInst *VAAI); @@ -335,7 +335,7 @@ public: /// be aliased by the specified instruction. These methods return true if any /// alias sets were eliminated. // Remove a location - bool remove(Value *Ptr, uint64_t Size, const MDNode *TBAAInfo); + bool remove(Value *Ptr, unsigned Size, const MDNode *TBAAInfo); bool remove(LoadInst *LI); bool remove(StoreInst *SI); bool remove(VAArgInst *VAAI); @@ -355,13 +355,13 @@ public: /// lives in. If the New argument is non-null, this method sets the value to /// true if a new alias set is created to contain the pointer (because the /// pointer didn't alias anything). - AliasSet &getAliasSetForPointer(Value *P, uint64_t Size, + AliasSet &getAliasSetForPointer(Value *P, unsigned Size, const MDNode *TBAAInfo, bool *New = 0); /// getAliasSetForPointerIfExists - Return the alias set containing the /// location specified if one exists, otherwise return null. - AliasSet *getAliasSetForPointerIfExists(Value *P, uint64_t Size, + AliasSet *getAliasSetForPointerIfExists(Value *P, unsigned Size, const MDNode *TBAAInfo) { return findAliasSetForPointer(P, Size, TBAAInfo); } @@ -369,7 +369,7 @@ public: /// containsPointer - Return true if the specified location is represented by /// this alias set, false otherwise. This does not modify the AST object or /// alias sets. - bool containsPointer(Value *P, uint64_t Size, const MDNode *TBAAInfo) const; + bool containsPointer(Value *P, unsigned Size, const MDNode *TBAAInfo) const; /// getAliasAnalysis - Return the underlying alias analysis object used by /// this tracker. @@ -416,7 +416,7 @@ private: return *Entry; } - AliasSet &addPointer(Value *P, uint64_t Size, const MDNode *TBAAInfo, + AliasSet &addPointer(Value *P, unsigned Size, const MDNode *TBAAInfo, AliasSet::AccessType E, bool &NewSet) { NewSet = false; @@ -424,7 +424,7 @@ private: AS.AccessTy |= E; return AS; } - AliasSet *findAliasSetForPointer(const Value *Ptr, uint64_t Size, + AliasSet *findAliasSetForPointer(const Value *Ptr, unsigned Size, const MDNode *TBAAInfo); AliasSet *findAliasSetForCallSite(CallSite CS); diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index e5fddabadd0..ab12b0df31d 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -283,7 +283,7 @@ void AliasAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { /// getTypeStoreSize - Return the TargetData store size for the given type, /// if known, or a conservative value otherwise. /// -uint64_t AliasAnalysis::getTypeStoreSize(const Type *Ty) { +unsigned AliasAnalysis::getTypeStoreSize(const Type *Ty) { return TD ? TD->getTypeStoreSize(Ty) : UnknownSize; } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index e10b29cce0d..ddf8b192c73 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -168,12 +168,12 @@ bool AAEval::runOnFunction(Function &F) { // iterate over the worklist, and run the full (n^2)/2 disambiguations for (SetVector::iterator I1 = Pointers.begin(), E = Pointers.end(); I1 != E; ++I1) { - uint64_t I1Size = AliasAnalysis::UnknownSize; + unsigned I1Size = AliasAnalysis::UnknownSize; const Type *I1ElTy = cast((*I1)->getType())->getElementType(); if (I1ElTy->isSized()) I1Size = AA.getTypeStoreSize(I1ElTy); for (SetVector::iterator I2 = Pointers.begin(); I2 != I1; ++I2) { - uint64_t I2Size = AliasAnalysis::UnknownSize; + unsigned I2Size = AliasAnalysis::UnknownSize; const Type *I2ElTy =cast((*I2)->getType())->getElementType(); if (I2ElTy->isSized()) I2Size = AA.getTypeStoreSize(I2ElTy); @@ -200,7 +200,7 @@ bool AAEval::runOnFunction(Function &F) { for (SetVector::iterator V = Pointers.begin(), Ve = Pointers.end(); V != Ve; ++V) { - uint64_t Size = AliasAnalysis::UnknownSize; + unsigned Size = AliasAnalysis::UnknownSize; const Type *ElTy = cast((*V)->getType())->getElementType(); if (ElTy->isSized()) Size = AA.getTypeStoreSize(ElTy); diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 7d05a9c35d9..90923e81da5 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -88,7 +88,7 @@ void AliasSet::removeFromTracker(AliasSetTracker &AST) { } void AliasSet::addPointer(AliasSetTracker &AST, PointerRec &Entry, - uint64_t Size, const MDNode *TBAAInfo, + unsigned Size, const MDNode *TBAAInfo, bool KnownMustAlias) { assert(!Entry.hasAliasSet() && "Entry already in set!"); @@ -138,7 +138,7 @@ void AliasSet::addCallSite(CallSite CS, AliasAnalysis &AA) { /// aliasesPointer - Return true if the specified pointer "may" (or must) /// alias one of the members in the set. /// -bool AliasSet::aliasesPointer(const Value *Ptr, uint64_t Size, +bool AliasSet::aliasesPointer(const Value *Ptr, unsigned Size, const MDNode *TBAAInfo, AliasAnalysis &AA) const { if (AliasTy == MustAlias) { @@ -210,7 +210,7 @@ void AliasSetTracker::clear() { /// that may alias the pointer, merge them together and return the unified set. /// AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr, - uint64_t Size, + unsigned Size, const MDNode *TBAAInfo) { AliasSet *FoundSet = 0; for (iterator I = begin(), E = end(); I != E; ++I) { @@ -229,7 +229,7 @@ AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr, /// containsPointer - Return true if the specified location is represented by /// this alias set, false otherwise. This does not modify the AST object or /// alias sets. -bool AliasSetTracker::containsPointer(Value *Ptr, uint64_t Size, +bool AliasSetTracker::containsPointer(Value *Ptr, unsigned Size, const MDNode *TBAAInfo) const { for (const_iterator I = begin(), E = end(); I != E; ++I) if (!I->Forward && I->aliasesPointer(Ptr, Size, TBAAInfo, AA)) @@ -258,7 +258,7 @@ AliasSet *AliasSetTracker::findAliasSetForCallSite(CallSite CS) { /// getAliasSetForPointer - Return the alias set that the specified pointer /// lives in. -AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, uint64_t Size, +AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, unsigned Size, const MDNode *TBAAInfo, bool *New) { AliasSet::PointerRec &Entry = getEntryFor(Pointer); @@ -283,7 +283,7 @@ AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, uint64_t Size, return AliasSets.back(); } -bool AliasSetTracker::add(Value *Ptr, uint64_t Size, const MDNode *TBAAInfo) { +bool AliasSetTracker::add(Value *Ptr, unsigned Size, const MDNode *TBAAInfo) { bool NewPtr; addPointer(Ptr, Size, TBAAInfo, AliasSet::NoModRef, NewPtr); return NewPtr; @@ -414,7 +414,7 @@ void AliasSetTracker::remove(AliasSet &AS) { } bool -AliasSetTracker::remove(Value *Ptr, uint64_t Size, const MDNode *TBAAInfo) { +AliasSetTracker::remove(Value *Ptr, unsigned Size, const MDNode *TBAAInfo) { AliasSet *AS = findAliasSetForPointer(Ptr, Size, TBAAInfo); if (!AS) return false; remove(*AS); @@ -422,7 +422,7 @@ AliasSetTracker::remove(Value *Ptr, uint64_t Size, const MDNode *TBAAInfo) { } bool AliasSetTracker::remove(LoadInst *LI) { - uint64_t Size = AA.getTypeStoreSize(LI->getType()); + unsigned Size = AA.getTypeStoreSize(LI->getType()); const MDNode *TBAAInfo = LI->getMetadata(LLVMContext::MD_tbaa); AliasSet *AS = findAliasSetForPointer(LI->getOperand(0), Size, TBAAInfo); if (!AS) return false; @@ -431,7 +431,7 @@ bool AliasSetTracker::remove(LoadInst *LI) { } bool AliasSetTracker::remove(StoreInst *SI) { - uint64_t Size = AA.getTypeStoreSize(SI->getOperand(0)->getType()); + unsigned Size = AA.getTypeStoreSize(SI->getOperand(0)->getType()); const MDNode *TBAAInfo = SI->getMetadata(LLVMContext::MD_tbaa); AliasSet *AS = findAliasSetForPointer(SI->getOperand(1), Size, TBAAInfo); if (!AS) return false; diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 58244fc11c7..4173bd00cd0 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -98,7 +98,7 @@ static bool isEscapeSource(const Value *V) { /// isObjectSmallerThan - Return true if we can prove that the object specified /// by V is smaller than Size. -static bool isObjectSmallerThan(const Value *V, uint64_t Size, +static bool isObjectSmallerThan(const Value *V, unsigned Size, const TargetData &TD) { const Type *AccessTy; if (const GlobalVariable *GV = dyn_cast(V)) { @@ -552,27 +552,27 @@ namespace { // aliasGEP - Provide a bunch of ad-hoc rules to disambiguate a GEP // instruction against another. - AliasResult aliasGEP(const GEPOperator *V1, uint64_t V1Size, - const Value *V2, uint64_t V2Size, + AliasResult aliasGEP(const GEPOperator *V1, unsigned V1Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo, const Value *UnderlyingV1, const Value *UnderlyingV2); // aliasPHI - Provide a bunch of ad-hoc rules to disambiguate a PHI // instruction against another. - AliasResult aliasPHI(const PHINode *PN, uint64_t PNSize, + AliasResult aliasPHI(const PHINode *PN, unsigned PNSize, const MDNode *PNTBAAInfo, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo); /// aliasSelect - Disambiguate a Select instruction against another value. - AliasResult aliasSelect(const SelectInst *SI, uint64_t SISize, + AliasResult aliasSelect(const SelectInst *SI, unsigned SISize, const MDNode *SITBAAInfo, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo); - AliasResult aliasCheck(const Value *V1, uint64_t V1Size, + AliasResult aliasCheck(const Value *V1, unsigned V1Size, const MDNode *V1TBAATag, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAATag); }; } // End of anonymous namespace @@ -691,7 +691,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, default: break; case Intrinsic::memcpy: case Intrinsic::memmove: { - uint64_t Len = UnknownSize; + unsigned Len = UnknownSize; if (ConstantInt *LenCI = dyn_cast(II->getArgOperand(2))) Len = LenCI->getZExtValue(); Value *Dest = II->getArgOperand(0); @@ -707,7 +707,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, // Since memset is 'accesses arguments' only, the AliasAnalysis base class // will handle it for the variable length case. if (ConstantInt *LenCI = dyn_cast(II->getArgOperand(2))) { - uint64_t Len = LenCI->getZExtValue(); + unsigned Len = LenCI->getZExtValue(); Value *Dest = II->getArgOperand(0); if (isNoAlias(Location(Dest, Len), Loc)) return NoModRef; @@ -727,7 +727,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, case Intrinsic::atomic_load_umin: if (TD) { Value *Op1 = II->getArgOperand(0); - uint64_t Op1Size = TD->getTypeStoreSize(Op1->getType()); + unsigned Op1Size = TD->getTypeStoreSize(Op1->getType()); MDNode *Tag = II->getMetadata(LLVMContext::MD_tbaa); if (isNoAlias(Location(Op1, Op1Size, Tag), Loc)) return NoModRef; @@ -736,7 +736,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, case Intrinsic::lifetime_start: case Intrinsic::lifetime_end: case Intrinsic::invariant_start: { - uint64_t PtrSize = + unsigned PtrSize = cast(II->getArgOperand(0))->getZExtValue(); if (isNoAlias(Location(II->getArgOperand(1), PtrSize, @@ -746,7 +746,7 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, break; } case Intrinsic::invariant_end: { - uint64_t PtrSize = + unsigned PtrSize = cast(II->getArgOperand(1))->getZExtValue(); if (isNoAlias(Location(II->getArgOperand(2), PtrSize, @@ -767,8 +767,8 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS, /// UnderlyingV2 is the same for V2. /// AliasAnalysis::AliasResult -BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, - const Value *V2, uint64_t V2Size, +BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, unsigned V1Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo, const Value *UnderlyingV1, const Value *UnderlyingV2) { @@ -878,10 +878,8 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, // If our known offset is bigger than the access size, we know we don't have // an alias. if (GEP1BaseOffset) { - if (GEP1BaseOffset >= 0 ? - (V2Size != UnknownSize && (uint64_t)GEP1BaseOffset >= V2Size) : - (V1Size != UnknownSize && -(uint64_t)GEP1BaseOffset >= V1Size && - GEP1BaseOffset != INT64_MIN)) + if (GEP1BaseOffset >= (int64_t)V2Size || + GEP1BaseOffset <= -(int64_t)V1Size) return NoAlias; } @@ -891,9 +889,9 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size, /// aliasSelect - Provide a bunch of ad-hoc rules to disambiguate a Select /// instruction against another. AliasAnalysis::AliasResult -BasicAliasAnalysis::aliasSelect(const SelectInst *SI, uint64_t SISize, +BasicAliasAnalysis::aliasSelect(const SelectInst *SI, unsigned SISize, const MDNode *SITBAAInfo, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo) { // If this select has been visited before, we're on a use-def cycle. // Such cycles are only valid when PHI nodes are involved or in unreachable @@ -941,9 +939,9 @@ BasicAliasAnalysis::aliasSelect(const SelectInst *SI, uint64_t SISize, // aliasPHI - Provide a bunch of ad-hoc rules to disambiguate a PHI instruction // against another. AliasAnalysis::AliasResult -BasicAliasAnalysis::aliasPHI(const PHINode *PN, uint64_t PNSize, +BasicAliasAnalysis::aliasPHI(const PHINode *PN, unsigned PNSize, const MDNode *PNTBAAInfo, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo) { // The PHI node has already been visited, avoid recursion any further. if (!Visited.insert(PN)) @@ -1015,9 +1013,9 @@ BasicAliasAnalysis::aliasPHI(const PHINode *PN, uint64_t PNSize, // such as array references. // AliasAnalysis::AliasResult -BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size, +BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size, const MDNode *V1TBAAInfo, - const Value *V2, uint64_t V2Size, + const Value *V2, unsigned V2Size, const MDNode *V2TBAAInfo) { // If either of the memory references is empty, it doesn't matter what the // pointer values are. diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp index b27ca47142f..daeaf344fdd 100644 --- a/lib/Analysis/Lint.cpp +++ b/lib/Analysis/Lint.cpp @@ -70,7 +70,7 @@ namespace { void visitCallSite(CallSite CS); void visitMemoryReference(Instruction &I, Value *Ptr, - uint64_t Size, unsigned Align, + unsigned Size, unsigned Align, const Type *Ty, unsigned Flags); void visitCallInst(CallInst &I); @@ -277,7 +277,7 @@ void Lint::visitCallSite(CallSite CS) { // Check that the memcpy arguments don't overlap. The AliasAnalysis API // isn't expressive enough for what we really want to do. Known partial // overlap is not distinguished from the case where nothing is known. - uint64_t Size = 0; + unsigned Size = 0; if (const ConstantInt *Len = dyn_cast(findValue(MCI->getLength(), /*OffsetOk=*/false))) @@ -361,7 +361,7 @@ void Lint::visitReturnInst(ReturnInst &I) { // TODO: Check that the reference is in bounds. // TODO: Check readnone/readonly function attributes. void Lint::visitMemoryReference(Instruction &I, - Value *Ptr, uint64_t Size, unsigned Align, + Value *Ptr, unsigned Size, unsigned Align, const Type *Ty, unsigned Flags) { // If no memory is being referenced, it doesn't matter if the pointer // is valid. diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index cba844067c2..26cb3a6a29b 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -79,7 +79,7 @@ namespace { AU.addPreserved(); } - uint64_t getPointerSize(Value *V) const; + unsigned getPointerSize(Value *V) const; }; } @@ -373,7 +373,7 @@ bool DSE::handleEndBlock(BasicBlock &BB) { } Value *killPointer = 0; - uint64_t killPointerSize = AliasAnalysis::UnknownSize; + unsigned killPointerSize = AliasAnalysis::UnknownSize; // If we encounter a use of the pointer, it is no longer considered dead if (LoadInst *L = dyn_cast(BBI)) { @@ -565,7 +565,7 @@ void DSE::DeleteDeadInstruction(Instruction *I, } while (!NowDeadInsts.empty()); } -uint64_t DSE::getPointerSize(Value *V) const { +unsigned DSE::getPointerSize(Value *V) const { if (TD) { if (AllocaInst *A = dyn_cast(V)) { // Get size information for the alloca diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index f4876eac43b..d4a9171e858 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -772,7 +772,7 @@ bool MemCpyOpt::processMemMove(MemMoveInst *M) { // If the memmove is a constant size, use it for the alias query, this allows // us to optimize things like: memmove(P, P+64, 64); - uint64_t MemMoveSize = AliasAnalysis::UnknownSize; + unsigned MemMoveSize = AliasAnalysis::UnknownSize; if (ConstantInt *Len = dyn_cast(M->getLength())) MemMoveSize = Len->getZExtValue();