class TruncInstCombine
Declaration
class TruncInstCombine { /* full declaration omitted */ };
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:54
Member Variables
- private llvm::AssumptionCache& AC
- private llvm::TargetLibraryInfo& TLI
- private const llvm::DataLayout& DL
- private const llvm::DominatorTree& DT
- private SmallVector<llvm::TruncInst*, 4> Worklist
- List of all TruncInst instructions to be processed.
- private llvm::TruncInst* CurrentTruncInst = nullptr
- Current processed TruncInst instruction.
- private MapVector<llvm::Instruction*, llvm::TruncInstCombine::Info> InstInfoMap
- An ordered map representing expression graph post-dominated by current processed TruncInst. It maps each instruction in the graph to its Info structure. The map is ordered such that each instruction appears before all other instructions in the graph that uses it.
Method Overview
- private unsigned int ComputeNumSignBits(const llvm::Value * V) const
- private void ReduceExpressionGraph(llvm::Type * SclTy)
- public TruncInstCombine(llvm::AssumptionCache & AC, llvm::TargetLibraryInfo & TLI, const llvm::DataLayout & DL, const llvm::DominatorTree & DT)
- private bool buildTruncExpressionGraph()
- private llvm::KnownBits computeKnownBits(const llvm::Value * V) const
- private llvm::Type * getBestTruncatedType()
- private unsigned int getMinBitWidth()
- private llvm::Value * getReducedOperand(llvm::Value * V, llvm::Type * SclTy)
- public bool run(llvm::Function & F)
Methods
¶unsigned int ComputeNumSignBits(
const llvm::Value* V) const
unsigned int ComputeNumSignBits(
const llvm::Value* V) const
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:117
Parameters
- const llvm::Value* V
¶void ReduceExpressionGraph(llvm::Type* SclTy)
void ReduceExpressionGraph(llvm::Type* SclTy)
Description
Create a new expression graph using the reduced /p SclTy type and replace the old expression graph with it. Also erase all instructions in the old graph, except those that are still needed outside the graph.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:136
Parameters
- llvm::Type* SclTy
- scalar version of new type to reduce expression graph into.
¶TruncInstCombine(llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo& TLI,
const llvm::DataLayout& DL,
const llvm::DominatorTree& DT)
TruncInstCombine(llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo& TLI,
const llvm::DataLayout& DL,
const llvm::DominatorTree& DT)
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:82
Parameters
- llvm::AssumptionCache& AC
- llvm::TargetLibraryInfo& TLI
- const llvm::DataLayout& DL
- const llvm::DominatorTree& DT
¶bool buildTruncExpressionGraph()
bool buildTruncExpressionGraph()
Description
Build expression graph dominated by the /p CurrentTruncInst and append it to the InstInfoMap container.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:94
Returns
true only if succeed to generate an eligible sub expression graph.
¶llvm::KnownBits computeKnownBits(
const llvm::Value* V) const
llvm::KnownBits computeKnownBits(
const llvm::Value* V) const
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:111
Parameters
- const llvm::Value* V
¶llvm::Type* getBestTruncatedType()
llvm::Type* getBestTruncatedType()
Description
Build an expression graph dominated by the current processed TruncInst and Check if it is eligible to be reduced to a smaller type.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:109
Returns
the scalar version of the new type to be used for the reduced expression graph, or nullptr if the expression graph is not eligible to be reduced.
¶unsigned int getMinBitWidth()
unsigned int getMinBitWidth()
Description
Calculate the minimal allowed bit-width of the chain ending with the currently visited truncate's operand.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:101
Returns
minimum number of bits to which the chain ending with the truncate's operand can be shrunk to.
¶llvm::Value* getReducedOperand(llvm::Value* V,
llvm::Type* SclTy)
llvm::Value* getReducedOperand(llvm::Value* V,
llvm::Type* SclTy)
Description
Given a \p V value and a \p SclTy scalar type return the generated reduced value of \p V based on the type \p SclTy.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:129
Parameters
- llvm::Value* V
- value to be reduced.
- llvm::Type* SclTy
- scalar version of new type to reduce to.
Returns
the new reduced value.
¶bool run(llvm::Function& F)
bool run(llvm::Function& F)
Description
Perform TruncInst pattern optimization on given function.
Declared at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h:87