#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/IteratedDominanceFrontier.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#define DEBUG_TYPE …
usingnamespacellvm;
MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive(
BasicBlock *BB,
DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> &CachedPreviousDef) { … }
MemoryAccess *MemorySSAUpdater::getPreviousDef(MemoryAccess *MA) { … }
MemoryAccess *MemorySSAUpdater::getPreviousDefInBlock(MemoryAccess *MA) { … }
MemoryAccess *MemorySSAUpdater::getPreviousDefFromEnd(
BasicBlock *BB,
DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> &CachedPreviousDef) { … }
MemoryAccess *MemorySSAUpdater::recursePhi(MemoryAccess *Phi) { … }
MemoryAccess *MemorySSAUpdater::tryRemoveTrivialPhi(MemoryPhi *Phi) { … }
template <class RangeType>
MemoryAccess *MemorySSAUpdater::tryRemoveTrivialPhi(MemoryPhi *Phi,
RangeType &Operands) { … }
void MemorySSAUpdater::insertUse(MemoryUse *MU, bool RenameUses) { … }
static void setMemoryPhiValueForBlock(MemoryPhi *MP, const BasicBlock *BB,
MemoryAccess *NewDef) { … }
void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) { … }
void MemorySSAUpdater::fixupDefs(const SmallVectorImpl<WeakVH> &Vars) { … }
void MemorySSAUpdater::removeEdge(BasicBlock *From, BasicBlock *To) { … }
void MemorySSAUpdater::removeDuplicatePhiEdgesBetween(const BasicBlock *From,
const BasicBlock *To) { … }
static MemoryAccess *onlySingleValue(MemoryPhi *MP) { … }
static MemoryAccess *getNewDefiningAccessForClone(MemoryAccess *MA,
const ValueToValueMapTy &VMap,
PhiToDefMap &MPhiMap,
MemorySSA *MSSA) { … }
void MemorySSAUpdater::cloneUsesAndDefs(BasicBlock *BB, BasicBlock *NewBB,
const ValueToValueMapTy &VMap,
PhiToDefMap &MPhiMap,
bool CloneWasSimplified) { … }
void MemorySSAUpdater::updatePhisWhenInsertingUniqueBackedgeBlock(
BasicBlock *Header, BasicBlock *Preheader, BasicBlock *BEBlock) { … }
void MemorySSAUpdater::updateForClonedLoop(const LoopBlocksRPO &LoopBlocks,
ArrayRef<BasicBlock *> ExitBlocks,
const ValueToValueMapTy &VMap,
bool IgnoreIncomingWithNoClones) { … }
void MemorySSAUpdater::updateForClonedBlockIntoPred(
BasicBlock *BB, BasicBlock *P1, const ValueToValueMapTy &VM) { … }
template <typename Iter>
void MemorySSAUpdater::privateUpdateExitBlocksForClonedLoop(
ArrayRef<BasicBlock *> ExitBlocks, Iter ValuesBegin, Iter ValuesEnd,
DominatorTree &DT) { … }
void MemorySSAUpdater::updateExitBlocksForClonedLoop(
ArrayRef<BasicBlock *> ExitBlocks, const ValueToValueMapTy &VMap,
DominatorTree &DT) { … }
void MemorySSAUpdater::updateExitBlocksForClonedLoop(
ArrayRef<BasicBlock *> ExitBlocks,
ArrayRef<std::unique_ptr<ValueToValueMapTy>> VMaps, DominatorTree &DT) { … }
void MemorySSAUpdater::applyUpdates(ArrayRef<CFGUpdate> Updates,
DominatorTree &DT, bool UpdateDT) { … }
void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
DominatorTree &DT) { … }
void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
DominatorTree &DT,
const GraphDiff<BasicBlock *> *GD) { … }
template <class WhereType>
void MemorySSAUpdater::moveTo(MemoryUseOrDef *What, BasicBlock *BB,
WhereType Where) { … }
void MemorySSAUpdater::moveBefore(MemoryUseOrDef *What, MemoryUseOrDef *Where) { … }
void MemorySSAUpdater::moveAfter(MemoryUseOrDef *What, MemoryUseOrDef *Where) { … }
void MemorySSAUpdater::moveToPlace(MemoryUseOrDef *What, BasicBlock *BB,
MemorySSA::InsertionPlace Where) { … }
void MemorySSAUpdater::moveAllAccesses(BasicBlock *From, BasicBlock *To,
Instruction *Start) { … }
void MemorySSAUpdater::moveAllAfterSpliceBlocks(BasicBlock *From,
BasicBlock *To,
Instruction *Start) { … }
void MemorySSAUpdater::moveAllAfterMergeBlocks(BasicBlock *From, BasicBlock *To,
Instruction *Start) { … }
void MemorySSAUpdater::wireOldPredecessorsToNewImmediatePredecessor(
BasicBlock *Old, BasicBlock *New, ArrayRef<BasicBlock *> Preds,
bool IdenticalEdgesWereMerged) { … }
void MemorySSAUpdater::removeMemoryAccess(MemoryAccess *MA, bool OptimizePhis) { … }
void MemorySSAUpdater::removeBlocks(
const SmallSetVector<BasicBlock *, 8> &DeadBlocks) { … }
void MemorySSAUpdater::tryRemoveTrivialPhis(ArrayRef<WeakVH> UpdatedPHIs) { … }
void MemorySSAUpdater::changeToUnreachable(const Instruction *I) { … }
MemoryAccess *MemorySSAUpdater::createMemoryAccessInBB(
Instruction *I, MemoryAccess *Definition, const BasicBlock *BB,
MemorySSA::InsertionPlace Point) { … }
MemoryUseOrDef *MemorySSAUpdater::createMemoryAccessBefore(
Instruction *I, MemoryAccess *Definition, MemoryUseOrDef *InsertPt) { … }
MemoryUseOrDef *MemorySSAUpdater::createMemoryAccessAfter(
Instruction *I, MemoryAccess *Definition, MemoryAccess *InsertPt) { … }