class AllocaSliceRewriter

Declaration

class AllocaSliceRewriter : public InstVisitor { /* full declaration omitted */ };

Description

Visitor to rewrite instructions using p particular slice of an alloca to use a new alloca. Also implements the rewriting to vector-based accesses when the partition passes the isVectorPromotionViable predicate. Most of the rewriting logic lives here.

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2250

Inherits from: InstVisitor

Member Variables

private const llvm::DataLayout& DL
private llvm::sroa::AllocaSlices& AS
private llvm::SROAPass& Pass
private llvm::AllocaInst& OldAI
private llvm::AllocaInst& NewAI
private const uint64_t NewAllocaBeginOffset
private const uint64_t NewAllocaEndOffset
private llvm::Type* NewAllocaTy
private llvm::IntegerType* IntTy
private llvm::VectorType* VecTy
private llvm::Type* ElementTy
private uint64_t ElementSize
private uint64_t BeginOffset = 0
private uint64_t EndOffset = 0
private uint64_t NewBeginOffset = 0
private uint64_t NewEndOffset = 0
private uint64_t SliceSize = 0
private bool IsSplittable = false
private bool IsSplit = false
private llvm::Use* OldUse = nullptr
private llvm::Instruction* OldPtr = nullptr
private SmallSetVector<llvm::PHINode*, 8>& PHIUsers
private SmallSetVector<llvm::SelectInst*, 8>& SelectUsers
private anonymous struct / union IRB

Method Overview

Methods

AllocaSliceRewriter(
    const llvm::DataLayout& DL,
    llvm::sroa::AllocaSlices& AS,
    llvm::SROAPass& Pass,
    llvm::AllocaInst& OldAI,
    llvm::AllocaInst& NewAI,
    uint64_t NewAllocaBeginOffset,
    uint64_t NewAllocaEndOffset,
    bool IsIntegerPromotable,
    llvm::VectorType* PromotableVecTy,
    SmallSetVector<llvm::PHINode*, 8>& PHIUsers,
    SmallSetVector<llvm::SelectInst*, 8>&
        SelectUsers)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2307

Parameters

const llvm::DataLayout& DL
llvm::sroa::AllocaSlices& AS
llvm::SROAPass& Pass
llvm::AllocaInst& OldAI
llvm::AllocaInst& NewAI
uint64_t NewAllocaBeginOffset
uint64_t NewAllocaEndOffset
bool IsIntegerPromotable
llvm::VectorType* PromotableVecTy
SmallSetVector<llvm::PHINode*, 8>& PHIUsers
SmallSetVector<llvm::SelectInst*, 8>& SelectUsers

void deleteIfTriviallyDead(llvm::Value* V)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2439

Parameters

llvm::Value* V

void fixLoadStoreAlign(llvm::Instruction& Root)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:3125

Parameters

llvm::Instruction& Root

unsigned int getIndex(uint64_t Offset)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2430

Parameters

uint64_t Offset

llvm::Value* getIntegerSplat(llvm::Value* V,
                             unsigned int Size)

Description

Compute an integer value from splatting an i8 across the given number of bytes. Note that this routine assumes an i8 is a byte. If that isn't true, don't call this routine. FIXME: Heed the advice above.

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2731

Parameters

llvm::Value* V
The i8 value to splat.
unsigned int Size
The number of bytes in the output (assuming i8 is one byte)

llvm::Value* getNewAllocaSlicePtr(
    (anonymous namespace)::IRBuilderTy& IRB,
    llvm::Type* PointerTy)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2382

Parameters

(anonymous namespace)::IRBuilderTy& IRB
llvm::Type* PointerTy

llvm::Align getSliceAlign()

Description

Compute suitable alignment to access this slice of the *new* alloca. You can optionally pass a type to this routine and if that type's ABI alignment is itself suitable, this will return zero.

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2425

llvm::Value* getVectorSplat(
    llvm::Value* V,
    unsigned int NumElements)

Description

Compute a vector splat for a given element value.

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2749

Parameters

llvm::Value* V
unsigned int NumElements

llvm::Value* rewriteIntegerLoad(
    llvm::LoadInst& LI)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2458

Parameters

llvm::LoadInst& LI

bool rewriteIntegerStore(llvm::Value* V,
                         llvm::StoreInst& SI,
                         llvm::AAMDNodes AATags)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2623

Parameters

llvm::Value* V
llvm::StoreInst& SI
llvm::AAMDNodes AATags

llvm::Value* rewriteVectorizedLoadInst(
    llvm::LoadInst& LI)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2445

Parameters

llvm::LoadInst& LI

bool rewriteVectorizedStoreInst(
    llvm::Value* V,
    llvm::StoreInst& SI,
    llvm::Value* OldOp,
    llvm::AAMDNodes AATags)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2592

Parameters

llvm::Value* V
llvm::StoreInst& SI
llvm::Value* OldOp
llvm::AAMDNodes AATags

bool visit(AllocaSlices::const_iterator I)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2338

Parameters

AllocaSlices::const_iterator I

bool visitInstruction(llvm::Instruction& I)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2377

Parameters

llvm::Instruction& I

bool visitIntrinsicInst(llvm::IntrinsicInst& II)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:3079

Parameters

llvm::IntrinsicInst& II

bool visitLoadInst(llvm::LoadInst& LI)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2482

Parameters

llvm::LoadInst& LI

bool visitMemSetInst(llvm::MemSetInst& II)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2755

Parameters

llvm::MemSetInst& II

bool visitMemTransferInst(
    llvm::MemTransferInst& II)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2881

Parameters

llvm::MemTransferInst& II

bool visitPHINode(llvm::PHINode& PN)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:3154

Parameters

llvm::PHINode& PN

bool visitSelectInst(llvm::SelectInst& SI)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:3187

Parameters

llvm::SelectInst& SI

bool visitStoreInst(llvm::StoreInst& SI)

Declared at: llvm/lib/Transforms/Scalar/SROA.cpp:2646

Parameters

llvm::StoreInst& SI