[llvm] r219068 - Make AAMDNodes ctor and operator bool (!!!) explicit, mop up bugs and weirdness exposed by it.
Benjamin Kramer
benny.kra at googlemail.com
Sat Oct 4 15:44:29 PDT 2014
Author: d0k
Date: Sat Oct 4 17:44:29 2014
New Revision: 219068
URL: http://llvm.org/viewvc/llvm-project?rev=219068&view=rev
Log:
Make AAMDNodes ctor and operator bool (!!!) explicit, mop up bugs and weirdness exposed by it.
Modified:
llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
llvm/trunk/include/llvm/IR/Metadata.h
llvm/trunk/include/llvm/LinkAllPasses.h
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/lib/Analysis/NoAliasAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Sat Oct 4 17:44:29 2014
@@ -568,14 +568,12 @@ public:
template<>
struct DenseMapInfo<AliasAnalysis::Location> {
static inline AliasAnalysis::Location getEmptyKey() {
- return
- AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(),
- 0, nullptr);
+ return AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(),
+ 0);
}
static inline AliasAnalysis::Location getTombstoneKey() {
- return
- AliasAnalysis::Location(DenseMapInfo<const Value *>::getTombstoneKey(),
- 0, nullptr);
+ return AliasAnalysis::Location(
+ DenseMapInfo<const Value *>::getTombstoneKey(), 0);
}
static unsigned getHashValue(const AliasAnalysis::Location &Val) {
return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Sat Oct 4 17:44:29 2014
@@ -70,20 +70,17 @@ public:
/// AAMDNodes - A collection of metadata nodes that might be associated with a
/// memory access used by the alias-analysis infrastructure.
struct AAMDNodes {
- AAMDNodes(MDNode *T = nullptr, MDNode *S = nullptr, MDNode *N = nullptr)
- : TBAA(T), Scope(S), NoAlias(N) {}
+ explicit AAMDNodes(MDNode *T = nullptr, MDNode *S = nullptr,
+ MDNode *N = nullptr)
+ : TBAA(T), Scope(S), NoAlias(N) {}
- bool operator == (const AAMDNodes &A) const {
- return equals(A);
+ bool operator==(const AAMDNodes &A) const {
+ return TBAA == A.TBAA && Scope == A.Scope && NoAlias == A.NoAlias;
}
- bool operator != (const AAMDNodes &A) const {
- return !equals(A);
- }
+ bool operator!=(const AAMDNodes &A) const { return !(*this == A); }
- operator bool() const {
- return TBAA || Scope || NoAlias;
- }
+ LLVM_EXPLICIT operator bool() const { return TBAA || Scope || NoAlias; }
/// TBAA - The tag for type-based alias analysis.
MDNode *TBAA;
@@ -93,11 +90,6 @@ struct AAMDNodes {
/// NoAlias - The tag specifying the noalias scope.
MDNode *NoAlias;
-
-protected:
- bool equals(const AAMDNodes &A) const {
- return TBAA == A.TBAA && Scope == A.Scope && NoAlias == A.NoAlias;
- }
};
// Specialize DenseMapInfo for AAMDNodes.
Modified: llvm/trunk/include/llvm/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)
+++ llvm/trunk/include/llvm/LinkAllPasses.h Sat Oct 4 17:44:29 2014
@@ -171,7 +171,7 @@ namespace {
llvm::RGPassManager RGM;
((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
- X.add((llvm::Value*)nullptr, 0, nullptr); // for -print-alias-sets
+ X.add(nullptr, 0, llvm::AAMDNodes()); // for -print-alias-sets
}
} ForcePassLinking; // Force link by creating a global definition.
}
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Sat Oct 4 17:44:29 2014
@@ -316,7 +316,7 @@ AliasAnalysis::getLocationForDest(const
// memcpy/memmove can have AA tags. For memcpy, they apply
// to both the source and the destination.
AAMDNodes AATags;
- MTI->getMetadata(AATags);
+ MTI->getAAMetadata(AATags);
return Location(MTI->getRawDest(), Size, AATags);
}
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sat Oct 4 17:44:29 2014
@@ -904,8 +904,8 @@ BasicAliasAnalysis::aliasGEP(const GEPOp
// derived pointer.
if (const GEPOperator *GEP2 = dyn_cast<GEPOperator>(V2)) {
// Do the base pointers alias?
- AliasResult BaseAlias = aliasCheck(UnderlyingV1, UnknownSize, nullptr,
- UnderlyingV2, UnknownSize, nullptr);
+ AliasResult BaseAlias = aliasCheck(UnderlyingV1, UnknownSize, AAMDNodes(),
+ UnderlyingV2, UnknownSize, AAMDNodes());
// Check for geps of non-aliasing underlying pointers where the offsets are
// identical.
@@ -988,7 +988,7 @@ BasicAliasAnalysis::aliasGEP(const GEPOp
if (V1Size == UnknownSize && V2Size == UnknownSize)
return MayAlias;
- AliasResult R = aliasCheck(UnderlyingV1, UnknownSize, nullptr,
+ AliasResult R = aliasCheck(UnderlyingV1, UnknownSize, AAMDNodes(),
V2, V2Size, V2AAInfo);
if (R != MustAlias)
// If V2 may alias GEP base pointer, conservatively returns MayAlias.
Modified: llvm/trunk/lib/Analysis/NoAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/NoAliasAnalysis.cpp?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/NoAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/NoAliasAnalysis.cpp Sat Oct 4 17:44:29 2014
@@ -57,8 +57,11 @@ namespace {
Location getArgLocation(ImmutableCallSite CS, unsigned ArgIdx,
ModRefResult &Mask) override {
Mask = ModRef;
- return Location(CS.getArgument(ArgIdx), UnknownSize,
- CS.getInstruction()->getMetadata(LLVMContext::MD_tbaa));
+ AAMDNodes AATags(
+ CS.getInstruction()->getMetadata(LLVMContext::MD_tbaa),
+ CS.getInstruction()->getMetadata(LLVMContext::MD_alias_scope),
+ CS.getInstruction()->getMetadata(LLVMContext::MD_noalias));
+ return Location(CS.getArgument(ArgIdx), UnknownSize, AATags);
}
ModRefResult getModRefInfo(ImmutableCallSite CS,
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Sat Oct 4 17:44:29 2014
@@ -247,12 +247,12 @@ MachineFunction::getMachineMemOperand(co
MachineMemOperand(MachinePointerInfo(MMO->getValue(),
MMO->getOffset()+Offset),
MMO->getFlags(), Size,
- MMO->getBaseAlignment(), nullptr);
+ MMO->getBaseAlignment());
return new (Allocator)
MachineMemOperand(MachinePointerInfo(MMO->getPseudoValue(),
MMO->getOffset()+Offset),
MMO->getFlags(), Size,
- MMO->getBaseAlignment(), nullptr);
+ MMO->getBaseAlignment());
}
MachineInstr::mmo_iterator
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=219068&r1=219067&r2=219068&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Oct 4 17:44:29 2014
@@ -1947,7 +1947,7 @@ SDValue AArch64TargetLowering::LowerForm
ArgValue = DAG.getExtLoad(ExtType, DL, VA.getLocVT(), Chain, FIN,
MachinePointerInfo::getFixedStack(FI),
- MemVT, false, false, false, 0, nullptr);
+ MemVT, false, false, false, 0);
InVals.push_back(ArgValue);
}
More information about the llvm-commits
mailing list