class OptimizationLevel

Declaration

class OptimizationLevel { /* full declaration omitted */ };

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:22

Member Variables

private unsigned int SpeedLevel = 2
private unsigned int SizeLevel = 0
public static const llvm::OptimizationLevel O0
Disable as many optimizations as possible. This doesn't completely disable the optimizer in all cases, for example always_inline functions can be required to be inlined for correctness.
public static const llvm::OptimizationLevel O1
As an example, complex loop transformations such as versioning, vectorization, or fusion don't make sense here due to the degree to which the executed code differs from the source code, and the compile time cost.
public static const llvm::OptimizationLevel O2
This is expected to be a good default optimization level for the vast majority of users.
public static const llvm::OptimizationLevel O3
Despite being willing to trade more compile time off to get improved execution time, this mode still tries to avoid superlinear growth in order to make even significantly slower compile times at least scale reasonably. This does not preclude very substantial constant factor costs though.
public static const llvm::OptimizationLevel Os
A consequence of the different core goal is that this should in general produce substantially smaller executables that still run in a reasonable amount of time.
public static const llvm::OptimizationLevel Oz
This is useful primarily when there are absolute size limitations and any effort taken to reduce the size is worth it regardless of the execution time impact. You should expect this level to produce rather slow, but very small, code.

Method Overview

Methods

OptimizationLevel(unsigned int SpeedLevel,
                  unsigned int SizeLevel)

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:25

Parameters

unsigned int SpeedLevel
unsigned int SizeLevel

OptimizationLevel()

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:37

unsigned int getSizeLevel() const

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:123

unsigned int getSpeedupLevel() const

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:121

bool isOptimizingForSize() const

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:112

bool isOptimizingForSpeed() const

Declared at: llvm/include/llvm/Passes/OptimizationLevel.h:110