[AST] Remove notion of volatile from alias sets [NFCI]
Volatility is not an aliasing property. We used to model volatile as if it had extremely conservative aliasing implications, but that hasn't been true for several years now. So, it doesn't make sense to be in AliasSet.
It also turns out the code is entirely a noop. Outside of the AST code to update it, there was only one user: load store promotion in LICM. L/S promotion doesn't need the check since it walks all the users of the address anyway. It already checks each load or store via !isUnordered which causes us to bail for volatile accesses. (Look at the lines immediately following the two remove asserts.)
There is the possibility of some small compile time impact here, but the only case which will get noticeably slower is a loop with a large number of loads and stores to the same address where only the last one we inspect is volatile. This is sufficiently rare it's not worth optimizing for..
llvm-svn: 340312
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 0470247..dc6ecd5 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -56,7 +56,6 @@
// Update the alias and access types of this set...
Access |= AS.Access;
Alias |= AS.Alias;
- Volatile |= AS.Volatile;
if (Alias == SetMustAlias) {
// Check that these two merged sets really are must aliases. Since both
@@ -365,15 +364,13 @@
void AliasSetTracker::add(LoadInst *LI) {
if (isStrongerThanMonotonic(LI->getOrdering())) return addUnknown(LI);
- AliasSet &AS = addPointer(MemoryLocation::get(LI), AliasSet::RefAccess);
- if (LI->isVolatile()) AS.setVolatile();
+ addPointer(MemoryLocation::get(LI), AliasSet::RefAccess);
}
void AliasSetTracker::add(StoreInst *SI) {
if (isStrongerThanMonotonic(SI->getOrdering())) return addUnknown(SI);
- AliasSet &AS = addPointer(MemoryLocation::get(SI), AliasSet::ModAccess);
- if (SI->isVolatile()) AS.setVolatile();
+ addPointer(MemoryLocation::get(SI), AliasSet::ModAccess);
}
void AliasSetTracker::add(VAArgInst *VAAI) {
@@ -382,24 +379,15 @@
void AliasSetTracker::add(AnyMemSetInst *MSI) {
auto MemLoc = MemoryLocation::getForDest(MSI);
- AliasSet &AS = addPointer(MemLoc, AliasSet::ModAccess);
- auto *MS = dyn_cast<MemSetInst>(MSI);
- if (MS && MS->isVolatile())
- AS.setVolatile();
+ addPointer(MemLoc, AliasSet::ModAccess);
}
void AliasSetTracker::add(AnyMemTransferInst *MTI) {
auto SrcLoc = MemoryLocation::getForSource(MTI);
- AliasSet &ASSrc = addPointer(SrcLoc, AliasSet::RefAccess);
+ addPointer(SrcLoc, AliasSet::RefAccess);
auto DestLoc = MemoryLocation::getForDest(MTI);
- AliasSet &ASDst = addPointer(DestLoc, AliasSet::ModAccess);
-
- auto* MT = dyn_cast<MemTransferInst>(MTI);
- if (MT && MT->isVolatile()) {
- ASSrc.setVolatile();
- ASDst.setVolatile();
- }
+ addPointer(DestLoc, AliasSet::ModAccess);
}
void AliasSetTracker::addUnknown(Instruction *Inst) {
@@ -468,12 +456,9 @@
add(Inst);
// Loop over all of the pointers in this alias set.
- for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) {
- AliasSet &NewAS =
- addPointer(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo(),
- (AliasSet::AccessLattice)AS.Access);
- if (AS.isVolatile()) NewAS.setVolatile();
- }
+ for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI)
+ addPointer(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo(),
+ (AliasSet::AccessLattice)AS.Access);
}
}
@@ -595,7 +580,6 @@
case ModRefAccess: OS << "Mod/Ref "; break;
default: llvm_unreachable("Bad value for Access!");
}
- if (isVolatile()) OS << "[volatile] ";
if (Forward)
OS << " forwarding to " << (void*)Forward;