class MemorySSA::OptimizeUses

Declaration

class MemorySSA::OptimizeUses { /* full declaration omitted */ };

Description

This class is a batch walker of all MemoryUse's in the program, and points their defining access at the thing that actually clobbers them. Because it is a batch walker that touches everything, it does not operate like the other walkers. This walker is basically performing a top-down SSA renaming pass, where the version stack is used as the cache. This enables it to be significantly more time and memory efficient than using the regular walker, which is walking bottom-up.

Declared at: llvm/lib/Analysis/MemorySSA.cpp:1323

Member Variables

private llvm::MemorySSA* MSSA
private CachingWalker<llvm::BatchAAResults>* Walker
private llvm::BatchAAResults* AA
private llvm::DominatorTree* DT

Method Overview

  • public OptimizeUses(llvm::MemorySSA * MSSA, CachingWalker<llvm::BatchAAResults> * Walker, llvm::BatchAAResults * BAA, llvm::DominatorTree * DT)
  • public void optimizeUses()
  • private void optimizeUsesInBlock(const llvm::BasicBlock *, unsigned long &, unsigned long &, SmallVectorImpl<llvm::MemoryAccess *> &, DenseMap<(anonymous namespace)::MemoryLocOrCall, llvm::MemorySSA::OptimizeUses::MemlocStackInfo> &)

Methods

OptimizeUses(
    llvm::MemorySSA* MSSA,
    CachingWalker<llvm::BatchAAResults>* Walker,
    llvm::BatchAAResults* BAA,
    llvm::DominatorTree* DT)

Declared at: llvm/lib/Analysis/MemorySSA.cpp:1325

Parameters

llvm::MemorySSA* MSSA
CachingWalker<llvm::BatchAAResults>* Walker
llvm::BatchAAResults* BAA
llvm::DominatorTree* DT

void optimizeUses()

Description

Optimize uses to point to their actual clobbering definitions.

Declared at: llvm/lib/Analysis/MemorySSA.cpp:1329

void optimizeUsesInBlock(
    const llvm::BasicBlock*,
    unsigned long&,
    unsigned long&,
    SmallVectorImpl<llvm::MemoryAccess*>&,
    DenseMap<
        (anonymous namespace)::MemoryLocOrCall,
        llvm::MemorySSA::OptimizeUses::
            MemlocStackInfo>&)

Description

Optimize the uses in a given block This is basically the SSA renaming algorithm, with one caveat: We are able to use a single stack for all MemoryUses. This is because the set of *possible* reaching MemoryDefs is the same for every MemoryUse. The *actual* clobbering MemoryDef is just going to be some position in that stack of possible ones. We track the stack positions that each MemoryLocation needs to check, and last ended at. This is because we only want to check the things that changed since last time. The same MemoryLocation should get clobbered by the same store (getModRefInfo does not use invariantness or things like this, and if they start, we can modify MemoryLocOrCall to include relevant data)

Declared at: llvm/lib/Analysis/MemorySSA.cpp:1350

Parameters

const llvm::BasicBlock*
unsigned long&
unsigned long&
SmallVectorImpl<llvm::MemoryAccess*>&
DenseMap<(anonymous namespace)::MemoryLocOrCall, llvm::MemorySSA::OptimizeUses:: MemlocStackInfo>&