mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
Enhance alias analysis for atomic instructions a bit. Upgrade a couple alias-analysis tests to the new atomic instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -237,6 +237,19 @@ AliasAnalysis::Location AliasAnalysis::getLocation(const VAArgInst *VI) {
|
||||
VI->getMetadata(LLVMContext::MD_tbaa));
|
||||
}
|
||||
|
||||
AliasAnalysis::Location
|
||||
AliasAnalysis::getLocation(const AtomicCmpXchgInst *CXI) {
|
||||
return Location(CXI->getPointerOperand(),
|
||||
getTypeStoreSize(CXI->getCompareOperand()->getType()),
|
||||
CXI->getMetadata(LLVMContext::MD_tbaa));
|
||||
}
|
||||
|
||||
AliasAnalysis::Location
|
||||
AliasAnalysis::getLocation(const AtomicRMWInst *RMWI) {
|
||||
return Location(RMWI->getPointerOperand(),
|
||||
getTypeStoreSize(RMWI->getValOperand()->getType()),
|
||||
RMWI->getMetadata(LLVMContext::MD_tbaa));
|
||||
}
|
||||
|
||||
AliasAnalysis::Location
|
||||
AliasAnalysis::getLocationForSource(const MemTransferInst *MTI) {
|
||||
@@ -317,6 +330,33 @@ AliasAnalysis::getModRefInfo(const VAArgInst *V, const Location &Loc) {
|
||||
return ModRef;
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefResult
|
||||
AliasAnalysis::getModRefInfo(const AtomicCmpXchgInst *CX, const Location &Loc) {
|
||||
// Acquire/Release cmpxchg has properties that matter for arbitrary addresses.
|
||||
if (CX->getOrdering() > Monotonic)
|
||||
return ModRef;
|
||||
|
||||
// If the cmpxchg address does not alias the location, it does not access it.
|
||||
if (!alias(getLocation(CX), Loc))
|
||||
return NoModRef;
|
||||
|
||||
return ModRef;
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefResult
|
||||
AliasAnalysis::getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc) {
|
||||
// Acquire/Release atomicrmw has properties that matter for arbitrary addresses.
|
||||
if (RMW->getOrdering() > Monotonic)
|
||||
return ModRef;
|
||||
|
||||
// If the atomicrmw address does not alias the location, it does not access it.
|
||||
if (!alias(getLocation(RMW), Loc))
|
||||
return NoModRef;
|
||||
|
||||
return ModRef;
|
||||
}
|
||||
|
||||
|
||||
// AliasAnalysis destructor: DO NOT move this to the header file for
|
||||
// AliasAnalysis or else clients of the AliasAnalysis class may not depend on
|
||||
// the AliasAnalysis.o file in the current .a file, causing alias analysis
|
||||
|
Reference in New Issue
Block a user