diff options
Diffstat (limited to 'gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp')
| -rw-r--r-- | gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp b/gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp index 833c6e09f6f..f12275aff38 100644 --- a/gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp +++ b/gnu/llvm/lib/Analysis/ScopedNoAliasAA.cpp @@ -34,11 +34,12 @@ #include "llvm/Analysis/ScopedNoAliasAA.h" #include "llvm/ADT/SmallPtrSet.h" -#include "llvm/IR/Constants.h" +#include "llvm/Analysis/MemoryLocation.h" +#include "llvm/IR/Instruction.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" -#include "llvm/IR/Module.h" #include "llvm/Pass.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -47,17 +48,18 @@ using namespace llvm; // can also be achieved by stripping the associated metadata tags from IR, but // this option is sometimes more convenient. static cl::opt<bool> EnableScopedNoAlias("enable-scoped-noalias", - cl::init(true)); + cl::init(true), cl::Hidden); namespace { + /// This is a simple wrapper around an MDNode which provides a higher-level /// interface by hiding the details of how alias analysis information is encoded /// in its operands. class AliasScopeNode { - const MDNode *Node; + const MDNode *Node = nullptr; public: - AliasScopeNode() : Node(nullptr) {} + AliasScopeNode() = default; explicit AliasScopeNode(const MDNode *N) : Node(N) {} /// Get the MDNode for this AliasScopeNode. @@ -70,7 +72,8 @@ public: return dyn_cast_or_null<MDNode>(Node->getOperand(1)); } }; -} // end of anonymous namespace + +} // end anonymous namespace AliasResult ScopedNoAliasAAResult::alias(const MemoryLocation &LocA, const MemoryLocation &LocB) { @@ -99,12 +102,12 @@ ModRefInfo ScopedNoAliasAAResult::getModRefInfo(ImmutableCallSite CS, if (!mayAliasInScopes(Loc.AATags.Scope, CS.getInstruction()->getMetadata( LLVMContext::MD_noalias))) - return MRI_NoModRef; + return ModRefInfo::NoModRef; if (!mayAliasInScopes( CS.getInstruction()->getMetadata(LLVMContext::MD_alias_scope), Loc.AATags.NoAlias)) - return MRI_NoModRef; + return ModRefInfo::NoModRef; return AAResultBase::getModRefInfo(CS, Loc); } @@ -117,12 +120,12 @@ ModRefInfo ScopedNoAliasAAResult::getModRefInfo(ImmutableCallSite CS1, if (!mayAliasInScopes( CS1.getInstruction()->getMetadata(LLVMContext::MD_alias_scope), CS2.getInstruction()->getMetadata(LLVMContext::MD_noalias))) - return MRI_NoModRef; + return ModRefInfo::NoModRef; if (!mayAliasInScopes( CS2.getInstruction()->getMetadata(LLVMContext::MD_alias_scope), CS1.getInstruction()->getMetadata(LLVMContext::MD_noalias))) - return MRI_NoModRef; + return ModRefInfo::NoModRef; return AAResultBase::getModRefInfo(CS1, CS2); } @@ -181,6 +184,7 @@ ScopedNoAliasAAResult ScopedNoAliasAA::run(Function &F, } char ScopedNoAliasAAWrapperPass::ID = 0; + INITIALIZE_PASS(ScopedNoAliasAAWrapperPass, "scoped-noalias", "Scoped NoAlias Alias Analysis", false, true) |
