|
LLVM 24.0.0git
|
Encapsulates MemorySSA, including all data associated with memory accesses. More...
#include "llvm/Analysis/MemorySSA.h"
Classes | |
| class | CachingWalker |
| A MemorySSAWalker that does AA walks to disambiguate accesses. More... | |
| class | ClobberWalkerBase |
| class | SkipSelfWalker |
Public Types | |
| enum class | VerificationLevel { Fast , Full } |
| enum | InsertionPlace { Beginning , End , BeforeTerminator } |
| Used in various insertion functions to specify whether we are talking about the beginning or end of a block. More... | |
| using | AccessList = iplist<MemoryAccess, ilist_tag<MSSAHelpers::AllAccessTag>> |
| using | DefsList |
Protected Member Functions | |
| template<typename IterT> | |
| void | verifyOrderingDominationAndDefUses (IterT Blocks, VerificationLevel=VerificationLevel::Fast) const |
| Verify ordering: the order and existence of MemoryAccesses matches the order and existence of memory affecting instructions. | |
| template<typename IterT> | |
| void | verifyDominationNumbers (IterT Blocks) const |
| Verify that all of the blocks we believe to have valid domination numbers actually have valid domination numbers. | |
| template<typename IterT> | |
| void | verifyPrevDefInPhis (IterT Blocks) const |
| LLVM_ABI void | moveTo (MemoryUseOrDef *What, BasicBlock *BB, AccessList::iterator Where) |
| LLVM_ABI void | moveTo (MemoryAccess *What, BasicBlock *BB, InsertionPlace Point) |
| void | renamePass (BasicBlock *BB, MemoryAccess *IncomingVal, SmallPtrSetImpl< BasicBlock * > &Visited) |
| LLVM_ABI void | removeFromLookups (MemoryAccess *) |
Properly remove MA from all of MemorySSA's lookup tables. | |
| LLVM_ABI void | removeFromLists (MemoryAccess *, bool ShouldDelete=true) |
Properly remove MA from all of MemorySSA's lists. | |
| LLVM_ABI void | insertIntoListsForBlock (MemoryAccess *, const BasicBlock *, InsertionPlace) |
| LLVM_ABI void | insertIntoListsBefore (MemoryAccess *, const BasicBlock *, AccessList::iterator) |
| LLVM_ABI MemoryUseOrDef * | createDefinedAccess (Instruction *, MemoryAccess *, const MemoryUseOrDef *Template=nullptr, bool CreationMustSucceed=true) |
Friends | |
| class | MemorySSAUpdater |
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition at line 692 of file MemorySSA.h.
Definition at line 743 of file MemorySSA.h.
Definition at line 744 of file MemorySSA.h.
Used in various insertion functions to specify whether we are talking about the beginning or end of a block.
| Enumerator | |
|---|---|
| Beginning | |
| End | |
| BeforeTerminator | |
Definition at line 781 of file MemorySSA.h.
|
strong |
| Enumerator | |
|---|---|
| Fast | |
| Full | |
Definition at line 773 of file MemorySSA.h.
| MemorySSA::MemorySSA | ( | Function & | Func, |
| AliasAnalysis * | AA, | ||
| DominatorTree * | DT ) |
Definition at line 1103 of file MemorySSA.cpp.
References assert(), llvm::getAnalysisOptions(), getWalker(), and llvm::iterator_range().
Referenced by llvm::MemorySSA::ClobberWalkerBase::ClobberWalkerBase(), and MemorySSA().
| MemorySSA::MemorySSA | ( | Loop & | L, |
| AliasAnalysis * | AA, | ||
| DominatorTree * | DT ) |
Definition at line 1122 of file MemorySSA.cpp.
References assert(), llvm::getAnalysisOptions(), getParent(), getWalker(), and llvm::map_range().
|
delete |
References getSkipSelfWalker(), getWalker(), LLVM_ABI, and MemorySSA().
| MemorySSA::~MemorySSA | ( | ) |
Definition at line 1144 of file MemorySSA.cpp.
References llvm::User::dropAllReferences().
|
protected |
Definition at line 1396 of file MemorySSA.cpp.
References assert(), I, llvm::isa(), llvm::MemoryUseOrDef::setDefiningAccess(), and Template.
| bool MemorySSA::dominates | ( | const MemoryAccess * | A, |
| const MemoryAccess * | B ) const |
Given two memory accesses in potentially different blocks, determine whether MemoryAccess A dominates MemoryAccess B.
Definition at line 1843 of file MemorySSA.cpp.
References llvm::MemoryAccess::getBlock(), isLiveOnEntryDef(), and locallyDominates().
Referenced by checkClobberSanity(), dominates(), getMatchingValue(), noConflictingReadWrites(), verifyOrderingDominationAndDefUses(), and writtenBetween().
| bool MemorySSA::dominates | ( | const MemoryAccess * | A, |
| const Use & | B ) const |
Given a MemoryAccess and a Use, determine whether MemoryAccess A dominates Use B.
Definition at line 1856 of file MemorySSA.cpp.
References llvm::cast(), dominates(), llvm::dyn_cast(), llvm::MemoryAccess::getBlock(), llvm::Use::getUser(), and locallyDominates().
| LLVM_DUMP_METHOD void MemorySSA::dump | ( | ) | const |
Definition at line 1572 of file MemorySSA.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and print().
|
inline |
Definition at line 783 of file MemorySSA.h.
Referenced by pointerInvalidatedByLoop(), and usersDominator().
|
inline |
Return the list of MemoryAccess's for a given basic block.
Definition at line 748 of file MemorySSA.h.
Referenced by findStoreForOutArgument(), foreachMemoryAccess(), isOnlyMemoryAccess(), noConflictingReadWrites(), llvm::SinkAndHoistLICMFlags::SinkAndHoistLICMFlags(), verifyDominationNumbers(), and verifyOrderingDominationAndDefUses().
|
inline |
Return the list of MemoryDef's and MemoryPhi's for a given basic block.
Definition at line 755 of file MemorySSA.h.
Referenced by pointerInvalidatedByBlock(), unswitchAllTrivialConditions(), verifyOrderingDominationAndDefUses(), and verifyPrevDefInPhis().
|
inline |
Definition at line 718 of file MemorySSA.h.
Referenced by checkClobberSanity().
|
inline |
Definition at line 734 of file MemorySSA.h.
|
inline |
Definition at line 714 of file MemorySSA.h.
References llvm::cast(), and llvm::cast_or_null().
|
inline |
Given a memory Mod/Ref'ing instruction, get the MemorySSA access associated with it.
If passed a basic block gets the memory phi node that exists for that block, if there is one. Otherwise, this will get a MemoryUseOrDef.
Definition at line 710 of file MemorySSA.h.
References llvm::cast_or_null(), and I.
Referenced by buildPartialInvariantUnswitchConditionalBranch(), llvm::canHoistLoad(), llvm::canSinkOrHoistInst(), cloneInstructionInExitBlock(), getMatchingValue(), getNewDefiningAccessForClone(), llvm::hasPartialIVCondition(), llvm::AMDGPU::isClobberedInFunction(), llvm::Loop::makeLoopInvariant(), llvm::MergeBlockIntoPredecessor(), moveInstructionBefore(), noConflictingReadWrites(), overreadUndefContents(), runMoveAutoInit(), simplifyLoopInst(), sinkInstruction(), turnGuardIntoBranch(), usersDominator(), verifyOrderingDominationAndDefUses(), and verifyPrevDefInPhis().
| MemorySSAWalker * MemorySSA::getSkipSelfWalker | ( | ) |
Definition at line 1275 of file MemorySSA.cpp.
Referenced by getClobberingMemoryAccess(), and MemorySSA().
| MemorySSAWalker * MemorySSA::getWalker | ( | ) |
Definition at line 1262 of file MemorySSA.cpp.
Referenced by getMatchingValue(), llvm::AMDGPU::isClobberedInFunction(), MemorySSA(), MemorySSA(), MemorySSA(), overreadUndefContents(), removeFromLookups(), and writtenBetween().
|
protected |
Definition at line 1320 of file MemorySSA.cpp.
References Accesses, llvm::simple_ilist< T, Options >::insert(), InsertPt, llvm::isa(), and llvm::simple_ilist< T, Options >::push_back().
Referenced by moveTo().
|
protected |
Definition at line 1290 of file MemorySSA.cpp.
References Accesses, Beginning, llvm::find_if_not(), llvm::simple_ilist< T, Options >::insert(), and llvm::isa().
Referenced by moveTo().
|
inline |
Return true if MA represents the live on entry value.
Loads and stores from pointer arguments and other global values may be defined by memory operations that do not occur in the current function, so they may be live on entry to the function. MemorySSA represents such memory state by the live on entry definition, which is guaranteed to occur before any other memory access in the function.
Definition at line 730 of file MemorySSA.h.
Referenced by checkClobberSanity(), dominates(), getNewDefiningAccessForClone(), hasUndefContents(), llvm::AMDGPU::isClobberedInFunction(), locallyDominates(), noConflictingReadWrites(), and pointerInvalidatedByLoop().
| bool MemorySSA::locallyDominates | ( | const MemoryAccess * | Dominator, |
| const MemoryAccess * | Dominatee ) const |
Given two memory accesses in the same basic block, determine whether MemoryAccess A dominates MemoryAccess B.
Determine, for two memory accesses in the same block, whether Dominator dominates Dominatee.
Dominator dominates Dominatee. Definition at line 1812 of file MemorySSA.cpp.
References assert(), llvm::MemoryAccess::getBlock(), and isLiveOnEntryDef().
Referenced by dominates(), dominates(), and pointerInvalidatedByBlock().
|
protected |
Definition at line 1371 of file MemorySSA.cpp.
References assert(), Beginning, llvm::MemoryAccess::getBlock(), insertIntoListsForBlock(), and llvm::isa().
|
protected |
Definition at line 1365 of file MemorySSA.cpp.
References insertIntoListsBefore().
Referenced by MemorySSAUpdater.
| void MemorySSA::print | ( | raw_ostream & | OS | ) | const |
Definition at line 1563 of file MemorySSA.cpp.
References llvm::GlobalValue::getParent(), and llvm::Module::print().
Referenced by dump(), and llvm::MemorySSAPrinterPass::run().
|
protected |
Properly remove MA from all of MemorySSA's lists.
Because of the way the intrusive list and use lists work, it is important to do removal in the right order. ShouldDelete defaults to true, and will cause the memory access to also be deleted, not just removed.
Definition at line 1539 of file MemorySSA.cpp.
References llvm::BasicBlock::erase(), llvm::MemoryAccess::getBlock(), and llvm::isa().
|
protected |
Properly remove MA from all of MemorySSA's lookup tables.
Definition at line 1512 of file MemorySSA.cpp.
References assert(), llvm::dyn_cast(), llvm::BasicBlock::erase(), llvm::MemoryAccess::getBlock(), llvm::MemoryUseOrDef::getMemoryInst(), getWalker(), llvm::MemorySSAWalker::invalidateInfo(), llvm::isa(), llvm::MemoryUseOrDef::setDefiningAccess(), and llvm::Value::use_empty().
|
inlineprotected |
|
protected |
Verify that all of the blocks we believe to have valid domination numbers actually have valid domination numbers.
Definition at line 1649 of file MemorySSA.cpp.
References Accesses, assert(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::SmallPtrSetImplBase::empty(), llvm::SmallPtrSetImpl< PtrType >::erase(), and getBlockAccesses().
Referenced by MemorySSAUpdater, and verifyMemorySSA().
| void MemorySSA::verifyMemorySSA | ( | VerificationLevel | VL = VerificationLevel::Fast | ) | const |
Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right places).
This is used by unit tests.
Definition at line 1575 of file MemorySSA.cpp.
References assert(), Full, llvm::iterator_range(), llvm::map_range(), verifyDominationNumbers(), verifyOrderingDominationAndDefUses(), and verifyPrevDefInPhis().
Referenced by llvm::deleteDeadLoop(), llvm::hoistRegion(), injectPendingInvariantConditions(), mergeBlocksIntoPredecessors(), llvm::promoteLoopAccessesToScalars(), llvm::FunctionToLoopPassAdaptor::run(), llvm::LoopFlattenPass::run(), llvm::LoopInstSimplifyPass::run(), llvm::LoopRotatePass::run(), llvm::SimpleLoopUnswitchPass::run(), runMoveAutoInit(), simplifyLoopInst(), simplifyOneLoop(), llvm::sinkRegion(), turnGuardIntoBranch(), turnSelectIntoBranch(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), and unswitchTrivialSwitch().
|
protected |
Verify ordering: the order and existence of MemoryAccesses matches the order and existence of memory affecting instructions.
Verify domination: each definition dominates all of its uses. Verify def-uses: the immediate use information - walk all the memory accesses and verifying that, for each use, it appears in the appropriate def's use list
Definition at line 1691 of file MemorySSA.cpp.
References assert(), B(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorImpl< T >::clear(), DL, dominates(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::end(), Full, getBlockAccesses(), getBlockDefs(), llvm::MemoryUseOrDef::getDefiningAccess(), getMemoryAccess(), I, llvm::is_contained(), llvm::isa(), llvm::pred_size(), llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::Value::uses().
Referenced by MemorySSAUpdater, and verifyMemorySSA().
|
protected |
Definition at line 1612 of file MemorySSA.cpp.
References assert(), getBlockDefs(), getMemoryAccess(), and I.
Referenced by MemorySSAUpdater, and verifyMemorySSA().
|
friend |
Definition at line 787 of file MemorySSA.h.
References Fast, LLVM_ABI, MemorySSAUpdater, moveTo(), verifyDominationNumbers(), verifyOrderingDominationAndDefUses(), and verifyPrevDefInPhis().
Referenced by MemorySSAUpdater.