LLVM 24.0.0git
llvm::LoopUnrollOptions Struct Reference

A set of parameters used to control various transforms performed by the LoopUnroll pass. More...

#include "llvm/Transforms/Scalar/LoopUnrollPass.h"

Public Member Functions

 LoopUnrollOptions (int OptLevel=2, bool OnlyWhenForced=false, bool ForgetSCEV=false)
LoopUnrollOptions & setPartial (bool Partial)
 Enables or disables partial unrolling.
LoopUnrollOptions & setRuntime (bool Runtime)
 Enables or disables unrolling of loops with runtime trip count.
LoopUnrollOptions & setPeeling (bool Peeling)
 Enables or disables loop peeling.
LoopUnrollOptions & setUpperBound (bool UpperBound)
 Enables or disables the use of trip count upper bound in loop unrolling.
LoopUnrollOptions & setOptLevel (int O)
LoopUnrollOptions & setProfileBasedPeeling (int O)
LoopUnrollOptions & setFullUnrollMaxCount (unsigned O)
LoopUnrollOptions & setPrepareForLTO (bool V)

Public Attributes

std::optional< bool > AllowPartial
std::optional< bool > AllowPeeling
std::optional< bool > AllowRuntime
std::optional< bool > AllowUpperBound
std::optional< bool > AllowProfileBasedPeeling
std::optional< unsigned > FullUnrollMaxCount
int OptLevel
bool OnlyWhenForced
 If false, use a cost model to determine whether unrolling of a loop is profitable.
const bool ForgetSCEV
 If true, forget all loops when unrolling.
bool PrepareForLTO = false
 If true, consider calls as inline candidates and defer unrolling so that LTO post-link inlining can consider them first.

Detailed Description

A set of parameters used to control various transforms performed by the LoopUnroll pass.

Each of the boolean parameters can be set to: true - enabling the transformation. false - disabling the transformation. None - relying on a global default.

There is also OptLevel parameter, which is used for additional loop unroll tuning.

Intended use is to create a default object, modify parameters with additional setters and then pass it to LoopUnrollPass.

Definition at line 67 of file LoopUnrollPass.h.

Constructor & Destructor Documentation

◆ LoopUnrollOptions()

llvm::LoopUnrollOptions::LoopUnrollOptions ( int OptLevel = 2,
bool OnlyWhenForced = false,
bool ForgetSCEV = false )
inline

Member Function Documentation

◆ setFullUnrollMaxCount()

LoopUnrollOptions & llvm::LoopUnrollOptions::setFullUnrollMaxCount ( unsigned O)
inline

Definition at line 134 of file LoopUnrollPass.h.

References FullUnrollMaxCount, and LoopUnrollOptions().

◆ setOptLevel()

LoopUnrollOptions & llvm::LoopUnrollOptions::setOptLevel ( int O)
inline

Definition at line 122 of file LoopUnrollPass.h.

References LoopUnrollOptions(), and OptLevel.

◆ setPartial()

LoopUnrollOptions & llvm::LoopUnrollOptions::setPartial ( bool Partial)
inline

Enables or disables partial unrolling.

When disabled only full unrolling is allowed.

Definition at line 97 of file LoopUnrollPass.h.

References AllowPartial, and LoopUnrollOptions().

◆ setPeeling()

LoopUnrollOptions & llvm::LoopUnrollOptions::setPeeling ( bool Peeling)
inline

Enables or disables loop peeling.

Definition at line 109 of file LoopUnrollPass.h.

References AllowPeeling, and LoopUnrollOptions().

◆ setPrepareForLTO()

LoopUnrollOptions & llvm::LoopUnrollOptions::setPrepareForLTO ( bool V)
inline

Definition at line 139 of file LoopUnrollPass.h.

References LoopUnrollOptions(), and PrepareForLTO.

◆ setProfileBasedPeeling()

LoopUnrollOptions & llvm::LoopUnrollOptions::setProfileBasedPeeling ( int O)
inline

Definition at line 128 of file LoopUnrollPass.h.

References AllowProfileBasedPeeling, and LoopUnrollOptions().

◆ setRuntime()

LoopUnrollOptions & llvm::LoopUnrollOptions::setRuntime ( bool Runtime)
inline

Enables or disables unrolling of loops with runtime trip count.

Definition at line 103 of file LoopUnrollPass.h.

References AllowRuntime, LoopUnrollOptions(), and llvm::Runtime.

◆ setUpperBound()

LoopUnrollOptions & llvm::LoopUnrollOptions::setUpperBound ( bool UpperBound)
inline

Enables or disables the use of trip count upper bound in loop unrolling.

Definition at line 116 of file LoopUnrollPass.h.

References AllowUpperBound, and LoopUnrollOptions().

Member Data Documentation

◆ AllowPartial

std::optional<bool> llvm::LoopUnrollOptions::AllowPartial

Definition at line 68 of file LoopUnrollPass.h.

Referenced by setPartial().

◆ AllowPeeling

std::optional<bool> llvm::LoopUnrollOptions::AllowPeeling

Definition at line 69 of file LoopUnrollPass.h.

Referenced by setPeeling().

◆ AllowProfileBasedPeeling

std::optional<bool> llvm::LoopUnrollOptions::AllowProfileBasedPeeling

Definition at line 72 of file LoopUnrollPass.h.

Referenced by setProfileBasedPeeling().

◆ AllowRuntime

std::optional<bool> llvm::LoopUnrollOptions::AllowRuntime

Definition at line 70 of file LoopUnrollPass.h.

Referenced by setRuntime().

◆ AllowUpperBound

std::optional<bool> llvm::LoopUnrollOptions::AllowUpperBound

Definition at line 71 of file LoopUnrollPass.h.

Referenced by setUpperBound().

◆ ForgetSCEV

const bool llvm::LoopUnrollOptions::ForgetSCEV

If true, forget all loops when unrolling.

If false, forget top-most loop of the currently processed loops, which removes one entry at a time from the internal SCEV records. For large loops, the former is faster.

Definition at line 84 of file LoopUnrollPass.h.

Referenced by LoopUnrollOptions().

◆ FullUnrollMaxCount

std::optional<unsigned> llvm::LoopUnrollOptions::FullUnrollMaxCount

Definition at line 73 of file LoopUnrollPass.h.

Referenced by setFullUnrollMaxCount().

◆ OnlyWhenForced

bool llvm::LoopUnrollOptions::OnlyWhenForced

If false, use a cost model to determine whether unrolling of a loop is profitable.

If true, only loops that explicitly request unrolling via metadata are considered. All other loops are skipped.

Definition at line 79 of file LoopUnrollPass.h.

Referenced by LoopUnrollOptions().

◆ OptLevel

int llvm::LoopUnrollOptions::OptLevel

Definition at line 74 of file LoopUnrollPass.h.

Referenced by LoopUnrollOptions(), and setOptLevel().

◆ PrepareForLTO

bool llvm::LoopUnrollOptions::PrepareForLTO = false

If true, consider calls as inline candidates and defer unrolling so that LTO post-link inlining can consider them first.

Definition at line 88 of file LoopUnrollPass.h.

Referenced by setPrepareForLTO().


The documentation for this struct was generated from the following file: