class UnrolledInstAnalyzer

Declaration

class UnrolledInstAnalyzer : private InstVisitor { /* full declaration omitted */ };

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:42

Inherits from: InstVisitor

Member Variables

private DenseMap< llvm::Value*, llvm::UnrolledInstAnalyzer::SimplifiedAddress> SimplifiedAddresses
In order to find the base pointer one needs to perform non-trivial traversal of the corresponding SCEV expression, so it's good to have the results saved.
private const llvm::SCEV* IterationNumber
SCEV expression corresponding to number of currently simulated iteration.
private DenseMap<llvm::Value*, llvm::Value*>& SimplifiedValues
While we walk the loop instructions, we build up and maintain a mapping of simplified values specific to this iteration. The idea is to propagate any special information we have about loads that can be replaced with constants after complete unrolling, and account for likely simplifications post-unrolling.
private llvm::ScalarEvolution& SE
private const llvm::Loop* L

Method Overview

Methods

UnrolledInstAnalyzer(
    unsigned int Iteration,
    DenseMap<llvm::Value*, llvm::Value*>&
        SimplifiedValues,
    llvm::ScalarEvolution& SE,
    const llvm::Loop* L)

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:51

Parameters

unsigned int Iteration
DenseMap<llvm::Value*, llvm::Value*>& SimplifiedValues
llvm::ScalarEvolution& SE
const llvm::Loop* L

bool simplifyInstWithSCEV(llvm::Instruction* I)

Description

Try to simplify instruction The idea is that some AddRec expressions become constants, which then could trigger folding of other instructions. However, that only happens for expressions whose start value is also constant, which isn't always the case. In another common and important case the start value is just some address (i.e. SCEVUnknown) - in this case we compute the offset and save it along with the base address instead.

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:84

Parameters

llvm::Instruction* I
using its SCEV expression.

bool visitBinaryOperator(llvm::BinaryOperator& I)

Description

Try to simplify binary operator I. TODO: Probably it's worth to hoist the code for estimating the simplifications effects to a separate class, since we have a very similar code in InlineCost already.

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:87

Parameters

llvm::BinaryOperator& I

bool visitCastInst(llvm::CastInst& I)

Description

Try to simplify cast instruction.

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:89

Parameters

llvm::CastInst& I

bool visitCmpInst(llvm::CmpInst& I)

Description

Try to simplify cmp instruction.

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:90

Parameters

llvm::CmpInst& I

bool visitInstruction(llvm::Instruction& I)

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:86

Parameters

llvm::Instruction& I

bool visitLoad(llvm::LoadInst& I)

Description

Try to fold load I.

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:88

Parameters

llvm::LoadInst& I

bool visitPHINode(llvm::PHINode& PN)

Declared at: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h:91

Parameters

llvm::PHINode& PN