Add a convenient form of AliasAnalysis::alias for the case where the sizes

are unknown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-08-03 00:56:30 +00:00
parent ab37f50838
commit 847a84efd2
3 changed files with 8 additions and 6 deletions

View File

@ -94,6 +94,11 @@ public:
virtual AliasResult alias(const Value *V1, unsigned V1Size, virtual AliasResult alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size); const Value *V2, unsigned V2Size);
/// alias - A convenience wrapper for the case where the sizes are unknown.
AliasResult alias(const Value *V1, const Value *V2) {
return alias(V1, ~0u, V2, ~0u);
}
/// isNoAlias - A trivial helper function to check to see if the specified /// isNoAlias - A trivial helper function to check to see if the specified
/// pointers are no-alias. /// pointers are no-alias.
bool isNoAlias(const Value *V1, unsigned V1Size, bool isNoAlias(const Value *V1, unsigned V1Size,

View File

@ -246,8 +246,7 @@ void Lint::visitCallSite(CallSite CS) {
// where nothing is known. // where nothing is known.
if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy()) if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy())
for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI) { for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI) {
Assert1(AI == BI || Assert1(AI == BI || AA->alias(*AI, *BI) != AliasAnalysis::MustAlias,
AA->alias(*AI, ~0u, *BI, ~0u) != AliasAnalysis::MustAlias,
"Unusual: noalias argument aliases another argument", &I); "Unusual: noalias argument aliases another argument", &I);
} }

View File

@ -195,8 +195,7 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
// FIXME: This only considers queries directly on the invariant-tagged // FIXME: This only considers queries directly on the invariant-tagged
// pointer, not on query pointers that are indexed off of them. It'd // pointer, not on query pointers that are indexed off of them. It'd
// be nice to handle that at some point. // be nice to handle that at some point.
AliasAnalysis::AliasResult R = AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(2), MemPtr);
AA->alias(II->getArgOperand(2), ~0U, MemPtr, ~0U);
if (R == AliasAnalysis::MustAlias) { if (R == AliasAnalysis::MustAlias) {
InvariantTag = II->getArgOperand(0); InvariantTag = II->getArgOperand(0);
continue; continue;
@ -208,8 +207,7 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
// FIXME: This only considers queries directly on the invariant-tagged // FIXME: This only considers queries directly on the invariant-tagged
// pointer, not on query pointers that are indexed off of them. It'd // pointer, not on query pointers that are indexed off of them. It'd
// be nice to handle that at some point. // be nice to handle that at some point.
AliasAnalysis::AliasResult R = AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(1), MemPtr);
AA->alias(II->getArgOperand(1), ~0U, MemPtr, ~0U);
if (R == AliasAnalysis::MustAlias) if (R == AliasAnalysis::MustAlias)
return MemDepResult::getDef(II); return MemDepResult::getDef(II);
} }