Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
LoopUnrollAndJamPass.cpp File Reference

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Macros

#define DEBUG_TYPE   "loop-unroll-and-jam"

Functions

static MDNodegetUnrollMetadataForLoop (const Loop *L, StringRef Name)
static bool hasAnyUnrollPragma (const Loop *L, StringRef Prefix)
static bool hasUnrollAndJamEnablePragma (const Loop *L)
static unsigned unrollAndJamCountPragmaValue (const Loop *L)
static uint64_t getUnrollAndJammedLoopSize (unsigned LoopSize, TargetTransformInfo::UnrollingPreferences &UP)
static bool computeUnrollAndJamCount (Loop *L, Loop *SubLoop, const TargetTransformInfo &TTI, DominatorTree &DT, LoopInfo *LI, AssumptionCache *AC, ScalarEvolution &SE, const SmallPtrSetImpl< const Value * > &EphValues, OptimizationRemarkEmitter *ORE, unsigned OuterTripCount, unsigned OuterTripMultiple, const UnrollCostEstimator &OuterUCE, unsigned InnerTripCount, unsigned InnerLoopSize, TargetTransformInfo::UnrollingPreferences &UP, TargetTransformInfo::PeelingPreferences &PP)
static LoopUnrollResult tryToUnrollAndJamLoop (Loop *L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution &SE, const TargetTransformInfo &TTI, AssumptionCache &AC, DependenceInfo &DI, OptimizationRemarkEmitter &ORE, int OptLevel)
static bool tryToUnrollAndJamLoop (LoopNest &LN, DominatorTree &DT, LoopInfo &LI, ScalarEvolution &SE, const TargetTransformInfo &TTI, AssumptionCache &AC, DependenceInfo &DI, OptimizationRemarkEmitter &ORE, int OptLevel, LPMUpdater &U, bool &AnyLoopRemoved)

Variables

static cl::opt< boolAllowUnrollAndJam ("allow-unroll-and-jam", cl::Hidden, cl::desc("Allows loops to be unroll-and-jammed."))
static cl::opt< unsignedUnrollAndJamCount ("unroll-and-jam-count", cl::Hidden, cl::desc("Use this unroll count for all loops including those with " "unroll_and_jam_count pragma values, for testing purposes"))
static cl::opt< unsignedUnrollAndJamThreshold ("unroll-and-jam-threshold", cl::init(60), cl::Hidden, cl::desc("Threshold to use for inner loop when doing unroll and jam."))
static cl::opt< unsignedPragmaUnrollAndJamThreshold ("pragma-unroll-and-jam-threshold", cl::init(1024), cl::Hidden, cl::desc("Unrolled size limit for loops with an unroll_and_jam(full) or " "unroll_count pragma."))
static const char *const LLVMLoopUnrollAndJamFollowupAll
static const char *const LLVMLoopUnrollAndJamFollowupInner
static const char *const LLVMLoopUnrollAndJamFollowupOuter
static const char *const LLVMLoopUnrollAndJamFollowupRemainderInner
static const char *const LLVMLoopUnrollAndJamFollowupRemainderOuter

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loop-unroll-and-jam"

Definition at line 53 of file LoopUnrollAndJamPass.cpp.

Function Documentation

◆ computeUnrollAndJamCount()

◆ getUnrollAndJammedLoopSize()

◆ getUnrollMetadataForLoop()

◆ hasAnyUnrollPragma()

bool hasAnyUnrollPragma ( const Loop * L,
StringRef Prefix )
static

◆ hasUnrollAndJamEnablePragma()

bool hasUnrollAndJamEnablePragma ( const Loop * L)
static

Definition at line 121 of file LoopUnrollAndJamPass.cpp.

References getUnrollMetadataForLoop().

Referenced by computeUnrollAndJamCount().

◆ tryToUnrollAndJamLoop() [1/2]

LoopUnrollResult tryToUnrollAndJamLoop ( Loop * L,
DominatorTree & DT,
LoopInfo * LI,
ScalarEvolution & SE,
const TargetTransformInfo & TTI,
AssumptionCache & AC,
DependenceInfo & DI,
OptimizationRemarkEmitter & ORE,
int OptLevel )
static

Definition at line 278 of file LoopUnrollAndJamPass.cpp.

References AllowUnrollAndJam, llvm::TargetTransformInfo::UnrollingPreferences::BEInsns, llvm::UnrollCostEstimator::canUnroll(), llvm::CodeMetrics::collectEphemeralValues(), computeUnrollAndJamCount(), llvm::UnrollCostEstimator::Convergence, llvm::TargetTransformInfo::UnrollingPreferences::Count, llvm::dbgs(), llvm::FullyUnrolled, llvm::gatherPeelingPreferences(), llvm::gatherUnrollingPreferences(), llvm::Loop::getLoopID(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::UnrollCostEstimator::getRolledLoopSize(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::ScalarEvolution::getSmallConstantTripMultiple(), hasAnyUnrollPragma(), llvm::hasUnrollAndJamTransformation(), llvm::isSafeToUnrollAndJam(), LLVM_DEBUG, LLVMLoopUnrollAndJamFollowupAll, LLVMLoopUnrollAndJamFollowupInner, LLVMLoopUnrollAndJamFollowupOuter, LLVMLoopUnrollAndJamFollowupRemainderInner, LLVMLoopUnrollAndJamFollowupRemainderOuter, llvm::makeFollowupLoopID(), llvm::None, llvm::UnrollCostEstimator::NumInlineCandidates, llvm::PartiallyUnrolled, llvm::Loop::setLoopID(), llvm::TM_Disable, llvm::TM_ForcedByUser, llvm::Unmodified, llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJam, llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJamInnerLoopThreshold, llvm::UnrollAndJamLoop(), UnrollAndJamThreshold, and llvm::TargetTransformInfo::UnrollingPreferences::UnrollRemainder.

Referenced by llvm::LoopUnrollAndJamPass::run(), and tryToUnrollAndJamLoop().

◆ tryToUnrollAndJamLoop() [2/2]

◆ unrollAndJamCountPragmaValue()

Variable Documentation

◆ AllowUnrollAndJam

cl::opt< bool > AllowUnrollAndJam("allow-unroll-and-jam", cl::Hidden, cl::desc("Allows loops to be unroll-and-jammed.")) ( "allow-unroll-and-jam" ,
cl::Hidden ,
cl::desc("Allows loops to be unroll-and-jammed.")  )
static

Referenced by tryToUnrollAndJamLoop().

◆ LLVMLoopUnrollAndJamFollowupAll

const char* const LLVMLoopUnrollAndJamFollowupAll
static
Initial value:
=
"llvm.loop.unroll_and_jam.followup_all"

Metadata attribute names

Definition at line 57 of file LoopUnrollAndJamPass.cpp.

Referenced by tryToUnrollAndJamLoop().

◆ LLVMLoopUnrollAndJamFollowupInner

const char* const LLVMLoopUnrollAndJamFollowupInner
static
Initial value:
=
"llvm.loop.unroll_and_jam.followup_inner"

Definition at line 59 of file LoopUnrollAndJamPass.cpp.

Referenced by tryToUnrollAndJamLoop().

◆ LLVMLoopUnrollAndJamFollowupOuter

const char* const LLVMLoopUnrollAndJamFollowupOuter
static
Initial value:
=
"llvm.loop.unroll_and_jam.followup_outer"

Definition at line 61 of file LoopUnrollAndJamPass.cpp.

Referenced by tryToUnrollAndJamLoop().

◆ LLVMLoopUnrollAndJamFollowupRemainderInner

const char* const LLVMLoopUnrollAndJamFollowupRemainderInner
static
Initial value:
=
"llvm.loop.unroll_and_jam.followup_remainder_inner"

Definition at line 63 of file LoopUnrollAndJamPass.cpp.

Referenced by tryToUnrollAndJamLoop().

◆ LLVMLoopUnrollAndJamFollowupRemainderOuter

const char* const LLVMLoopUnrollAndJamFollowupRemainderOuter
static
Initial value:
=
"llvm.loop.unroll_and_jam.followup_remainder_outer"

Definition at line 65 of file LoopUnrollAndJamPass.cpp.

Referenced by tryToUnrollAndJamLoop().

◆ PragmaUnrollAndJamThreshold

cl::opt< unsigned > PragmaUnrollAndJamThreshold("pragma-unroll-and-jam-threshold", cl::init(1024), cl::Hidden, cl::desc("Unrolled size limit for loops with an unroll_and_jam(full) or " "unroll_count pragma.")) ( "pragma-unroll-and-jam-threshold" ,
cl::init(1024) ,
cl::Hidden ,
cl::desc("Unrolled size limit for loops with an unroll_and_jam(full) or " "unroll_count pragma.")  )
static

◆ UnrollAndJamCount

cl::opt< unsigned > UnrollAndJamCount("unroll-and-jam-count", cl::Hidden, cl::desc("Use this unroll count for all loops including those with " "unroll_and_jam_count pragma values, for testing purposes")) ( "unroll-and-jam-count" ,
cl::Hidden ,
cl::desc("Use this unroll count for all loops including those with " "unroll_and_jam_count pragma values, for testing purposes")  )
static

◆ UnrollAndJamThreshold

cl::opt< unsigned > UnrollAndJamThreshold("unroll-and-jam-threshold", cl::init(60), cl::Hidden, cl::desc("Threshold to use for inner loop when doing unroll and jam.")) ( "unroll-and-jam-threshold" ,
cl::init(60) ,
cl::Hidden ,
cl::desc("Threshold to use for inner loop when doing unroll and jam.")  )
static

Referenced by tryToUnrollAndJamLoop().