diff options
author | Alina Sbirlea <asbirlea@google.com> | 2017-12-05 20:12:23 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2017-12-05 20:12:23 +0000 |
commit | 63d2250a42b7b1e35e747ab07e181d2d8ec86dbc (patch) | |
tree | 345563f84db07f03c3bf6c60b7acfb955089c956 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | f6ae323ddf4c193d8a26a490cba3c6608e0dc91b (diff) | |
download | llvm-63d2250a42b7b1e35e747ab07e181d2d8ec86dbc.zip llvm-63d2250a42b7b1e35e747ab07e181d2d8ec86dbc.tar.gz llvm-63d2250a42b7b1e35e747ab07e181d2d8ec86dbc.tar.bz2 |
Modify ModRefInfo values using static inline method abstractions [NFC].
Summary:
The aim is to make ModRefInfo checks and changes more intuitive
and less error prone using inline methods that abstract the bit operations.
Ideally ModRefInfo would become an enum class, but that change will require
a wider set of changes into FunctionModRefBehavior.
Reviewers: sanjoy, george.burgess.iv, dberlin, hfinkel
Subscribers: nlopes, llvm-commits
Differential Revision: https://reviews.llvm.org/D40749
llvm-svn: 319821
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index fb9ece2..de0b023 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -809,12 +809,12 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS, // Operand aliases 'Object', but call doesn't modify it. Strengthen // initial assumption and keep looking in case if there are more aliases. if (CS.onlyReadsMemory(OperandNo)) { - Result = static_cast<ModRefInfo>(Result | MRI_Ref); + Result = setRef(Result); continue; } // Operand aliases 'Object' but call only writes into it. if (CS.doesNotReadMemory(OperandNo)) { - Result = static_cast<ModRefInfo>(Result | MRI_Mod); + Result = setMod(Result); continue; } // This operand aliases 'Object' and call reads and writes into it. @@ -832,7 +832,7 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS, // routines do not read values visible in the IR. TODO: Consider special // casing realloc and strdup routines which access only their arguments as // well. Or alternatively, replace all of this with inaccessiblememonly once - // that's implemented fully. + // that's implemented fully. auto *Inst = CS.getInstruction(); if (isMallocOrCallocLikeFn(Inst, &TLI)) { // Be conservative if the accessed pointer may alias the allocation - @@ -860,9 +860,9 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS, // It's also possible for Loc to alias both src and dest, or neither. ModRefInfo rv = MRI_NoModRef; if (SrcAA != NoAlias) - rv = static_cast<ModRefInfo>(rv | MRI_Ref); + rv = setRef(rv); if (DestAA != NoAlias) - rv = static_cast<ModRefInfo>(rv | MRI_Mod); + rv = setMod(rv); return rv; } @@ -933,10 +933,12 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS1, // possibilities for guard intrinsics. if (isIntrinsicCall(CS1, Intrinsic::experimental_guard)) - return getModRefBehavior(CS2) & MRI_Mod ? MRI_Ref : MRI_NoModRef; + return isModSet(ModRefInfo(getModRefBehavior(CS2))) ? MRI_Ref + : MRI_NoModRef; if (isIntrinsicCall(CS2, Intrinsic::experimental_guard)) - return getModRefBehavior(CS1) & MRI_Mod ? MRI_Mod : MRI_NoModRef; + return isModSet(ModRefInfo(getModRefBehavior(CS1))) ? MRI_Mod + : MRI_NoModRef; // The AAResultBase base class has some smarts, lets use them. return AAResultBase::getModRefInfo(CS1, CS2); |