Index: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h =================================================================== --- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h +++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h @@ -342,18 +342,6 @@ void add(const AliasSetTracker &AST); // Add alias relations from another AST bool addUnknown(Instruction *I); - /// These methods are used to remove all entries that might be aliased by the - /// specified instruction. These methods return true if any alias sets were - /// eliminated. - bool remove(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo); - bool remove(LoadInst *LI); - bool remove(StoreInst *SI); - bool remove(VAArgInst *VAAI); - bool remove(MemSetInst *MSI); - bool remove(Instruction *I); - void remove(AliasSet &AS); - bool removeUnknown(Instruction *I); - void clear(); /// Return the alias sets that are active. @@ -374,11 +362,6 @@ return mergeAliasSetsForPointer(P, Size, AAInfo); } - /// 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(const Value *P, uint64_t Size, - const AAMDNodes &AAInfo) const; - /// Return true if the specified instruction "may" (or must) alias one of the /// members in any of the sets. bool containsUnknown(const Instruction *I) const; Index: llvm/trunk/lib/Analysis/AliasSetTracker.cpp =================================================================== --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp @@ -229,17 +229,6 @@ return FoundSet; } -/// 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(const Value *Ptr, uint64_t Size, - const AAMDNodes &AAInfo) const { - for (const AliasSet &AS : *this) - if (!AS.Forward && AS.aliasesPointer(Ptr, Size, AAInfo, AA)) - return true; - return false; -} - bool AliasSetTracker::containsUnknown(const Instruction *Inst) const { for (const AliasSet &AS : *this) if (!AS.Forward && AS.aliasesUnknownInst(Inst, AA)) @@ -428,124 +417,6 @@ } } -/// remove - Remove the specified (potentially non-empty) alias set from the -/// tracker. -void AliasSetTracker::remove(AliasSet &AS) { - // Drop all call sites. - if (!AS.UnknownInsts.empty()) - AS.dropRef(*this); - AS.UnknownInsts.clear(); - - // Clear the alias set. - unsigned NumRefs = 0; - while (!AS.empty()) { - AliasSet::PointerRec *P = AS.PtrList; - - Value *ValToRemove = P->getValue(); - - // Unlink and delete entry from the list of values. - P->eraseFromList(); - - // Remember how many references need to be dropped. - ++NumRefs; - - // Finally, remove the entry. - PointerMap.erase(ValToRemove); - } - - // Stop using the alias set, removing it. - AS.RefCount -= NumRefs; - if (AS.RefCount == 0) - AS.removeFromTracker(*this); -} - -bool -AliasSetTracker::remove(Value *Ptr, uint64_t Size, const AAMDNodes &AAInfo) { - AliasSet *AS = mergeAliasSetsForPointer(Ptr, Size, AAInfo); - if (!AS) return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::remove(LoadInst *LI) { - const DataLayout &DL = LI->getModule()->getDataLayout(); - uint64_t Size = DL.getTypeStoreSize(LI->getType()); - - AAMDNodes AAInfo; - LI->getAAMetadata(AAInfo); - - AliasSet *AS = mergeAliasSetsForPointer(LI->getOperand(0), Size, AAInfo); - if (!AS) return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::remove(StoreInst *SI) { - const DataLayout &DL = SI->getModule()->getDataLayout(); - uint64_t Size = DL.getTypeStoreSize(SI->getOperand(0)->getType()); - - AAMDNodes AAInfo; - SI->getAAMetadata(AAInfo); - - AliasSet *AS = mergeAliasSetsForPointer(SI->getOperand(1), Size, AAInfo); - if (!AS) return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::remove(VAArgInst *VAAI) { - AAMDNodes AAInfo; - VAAI->getAAMetadata(AAInfo); - - AliasSet *AS = mergeAliasSetsForPointer(VAAI->getOperand(0), - MemoryLocation::UnknownSize, AAInfo); - if (!AS) return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::remove(MemSetInst *MSI) { - AAMDNodes AAInfo; - MSI->getAAMetadata(AAInfo); - uint64_t Len; - - if (ConstantInt *C = dyn_cast(MSI->getLength())) - Len = C->getZExtValue(); - else - Len = MemoryLocation::UnknownSize; - - AliasSet *AS = mergeAliasSetsForPointer(MSI->getRawDest(), Len, AAInfo); - if (!AS) - return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::removeUnknown(Instruction *I) { - if (!I->mayReadOrWriteMemory()) - return false; // doesn't alias anything - - AliasSet *AS = findAliasSetForUnknownInst(I); - if (!AS) return false; - remove(*AS); - return true; -} - -bool AliasSetTracker::remove(Instruction *I) { - // Dispatch to one of the other remove methods... - if (LoadInst *LI = dyn_cast(I)) - return remove(LI); - if (StoreInst *SI = dyn_cast(I)) - return remove(SI); - if (VAArgInst *VAAI = dyn_cast(I)) - return remove(VAAI); - if (MemSetInst *MSI = dyn_cast(I)) - return remove(MSI); - return removeUnknown(I); - // FIXME: add support of memcpy and memmove. -} - - // deleteValue method - This method is used to remove a pointer value from the // AliasSetTracker entirely. It should be used when an instruction is deleted // from the program to update the AST. If you don't use this, you would have