}
public:
- /// Return true if the specified pointer "may" (or must) alias one of the
- /// members in the set.
- bool aliasesPointer(const Value *Ptr, LocationSize Size,
- const AAMDNodes &AAInfo, AliasAnalysis &AA) const;
+ /// If the specified pointer "may" (or must) alias one of the members in the
+ /// set return the appropriate AliasResult. Otherwise return NoAlias.
+ AliasResult aliasesPointer(const Value *Ptr, LocationSize Size,
+ const AAMDNodes &AAInfo, AliasAnalysis &AA) const;
bool aliasesUnknownInst(const Instruction *Inst, AliasAnalysis &AA) const;
};
Access = ModRefAccess;
}
-/// aliasesPointer - Return true if the specified pointer "may" (or must)
-/// alias one of the members in the set.
+/// aliasesPointer - If the specified pointer "may" (or must) alias one of the
+/// members in the set return the appropriate AliasResult. Otherwise return
+/// NoAlias.
///
-bool AliasSet::aliasesPointer(const Value *Ptr, LocationSize Size,
- const AAMDNodes &AAInfo,
- AliasAnalysis &AA) const {
+AliasResult AliasSet::aliasesPointer(const Value *Ptr, LocationSize Size,
+ const AAMDNodes &AAInfo,
+ AliasAnalysis &AA) const {
if (AliasAny)
- return true;
+ return MayAlias;
if (Alias == SetMustAlias) {
assert(UnknownInsts.empty() && "Illegal must alias set!");
// 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 (AA.alias(MemoryLocation(Ptr, Size, AAInfo),
- MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo())))
- return true;
+ if (AliasResult AR = AA.alias(
+ MemoryLocation(Ptr, Size, AAInfo),
+ MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo())))
+ return AR;
// Check the unknown instructions...
if (!UnknownInsts.empty()) {
if (auto *Inst = getUnknownInst(i))
if (isModOrRefSet(
AA.getModRefInfo(Inst, MemoryLocation(Ptr, Size, AAInfo))))
- return true;
+ return MayAlias;
}
- return false;
+ return NoAlias;
}
bool AliasSet::aliasesUnknownInst(const Instruction *Inst,