Skip to content

Optimization Passes List

This is an automatically generated list of all optimization passes available with the default opt_main. This is generated automatically based on comments in the header files.

If the opt level is set below 'Min opt level' the pass will act as a no-op.

If the opt level is set above 'Cap opt level' the pass (or passes within the compound pass) will be executed with the opt level capped to the specified value.

default_pipeline - The default pipeline.

Text-proto

Invoked Passes

arith_simp - Arithmetic Simplifications

This pass performs various arithmetic optimizations such as replacement of divide by a constant with non-divide operations.

Header

array_simp - Array Simplification

Pass which simplifies or eliminates some array-type operations such as ArrayIndex.

Header

array_untuple - Array UnTuple

Pass which changes any (non-external) array-of-tuple into a tuple-of-arrays. We can see through tuples quite well but can't see through arrays to anywhere near the same extent. Therefore the struct-of-array representation is always superior.

Note that this pass makes no attempt to unpack or repack arrays which escape the function-base. This means that anything which comes in through a function param, or a procs recv or escapes through a function return or a proc send is not untuple'd. TODO(allight): We could do this at the cost of a significant number of ir nodes. We should experiment to see if this is worth doing.

Header

basic_simp - Basic Simplifications

This pass does simple pattern-matching optimizations which are ~always a good idea to do (replacing a node with a constant, removing operands of nodes, etc). They improve QoR, do not increase the number of nodes in the graph, preserve the same abstraction level, and do not impede later optimizations via obfuscation. These optimizations require no analyses beyond looking at the node and its operands. Examples include: not(not(x)) => x, x + 0 => x, etc.

Header

bdd_cse - BDD-based Common Subexpression Elimination

Pass which commons equivalent expressions in the graph using binary decision diagrams.

Header

bdd_simp - BDD-based Simplification

Runs BDD-based simplifications on the function. Currently this is a very limited set of optimization including one-hot removal and replacement of statically known values with literals. TODO(meheff): Add more BDD-based optimizations.

Header

bdd_simp(2) - BDD-based Simplification with opt_level <= 2

Runs BDD-based simplifications on the function. Currently this is a very limited set of optimization including one-hot removal and replacement of statically known values with literals. TODO(meheff): Add more BDD-based optimizations.

Header

bdd_simp(3) - BDD-based Simplification with opt_level <= 3

Runs BDD-based simplifications on the function. Currently this is a very limited set of optimization including one-hot removal and replacement of statically known values with literals. TODO(meheff): Add more BDD-based optimizations.

Header

bitslice_simp - Bit-slice simplification

Pass which simplifies bit-slices. This includes collapsing sequential bit-slices, eliminating degenerate full-width slices, and others.

Header

bool_simp - boolean simplification

Attempts to simplify bitwise / boolean expressions (e.g. of multiple variables).

Header

canon - Canonicalization

class CanonicalizationPass iterates over nodes and tries to canonicalize the expressions found. For example, for an add between a node and a literal, the literal should only be the 2nd operand. This preprocessing of the IR helps to simplify later passes.

Header

channel_legalization - Legalize multiple send/recvs per channel

Pass that legalizes multiple send/receive operations per channel.

This pass adds cross-activation tokens to guarantee that later activations of a proc cannot send or receive on a channel until all previous activations have completed working with that channel.

Header

comparison_simp - Comparison Simplification

Simplifies logical operations on the results of comparison operations. For example:

eq(x, 0) && ne(x, 1) => eq(x, 0) eq(x, 0) && ne(x, 0) => 0 eq(x, 0) || ne(x, 0) => 1

Header

concat_simp - Concat simplification

Pass which simplifies concats. This includes removing single-operand concats, flattening trees of dependent concats, and others.

Header

cond_spec(Bdd) - Conditional specialization

Pass which specializes arms of select operations based on their selector value.

Header

cond_spec(false) - Conditional specialization

Pass which specializes arms of select operations based on their selector value.

Header

cond_spec(noBdd) - Conditional specialization

Pass which specializes arms of select operations based on their selector value.

Header

cond_spec(true) - Conditional specialization

Pass which specializes arms of select operations based on their selector value.

Header

const_fold - Constant folding

Pass which performs constant folding. Every op with only literal operands is replaced by a equivalent literal. Runs DCE after constant folding.

Header

cse - Common subexpression elimination

Pass which performs common subexpression elimination. Equivalent ops with the same operands are commoned. The pass can find arbitrarily large common expressions.

Header

dataflow - Dataflow Optimization

An optimization which uses a lattice-based dataflow analysis to find equivalent nodes in the graph and replace them with a simpler form. The analysis traces through tuples, arrays, and select operations. Optimizations which can be performed by this pass:

tuple_index(tuple(x, y), index=1)  =>  y

select(selector, {z, z})  =>  z

array_index(array_update(A, x, index={42}), index={42})  =>  x

Header

dce - Dead Code Elimination

class DeadCodeEliminationPass iterates up from a functions result nodes and marks all visited node. After that, all unvisited nodes are considered dead.

Header

dfe - Dead Function Elimination

This pass removes unreachable procs/blocks/functions from the package. The pass requires top be set in order remove any constructs.

Header

fixedpoint_proc_state_flattening - Proc State Flattening

Prepare proc state for further analysis by removing arrays and tuples.

Text-proto

Options Set

Run to a fixedpoint.

Invoked Passes

fixedpoint_simp - Fixed-point Simplification

Standard simplification pipeline.

This is run to a fixedpoint and avoids many time-consuming analyses.

Text-proto

Options Set

Run to a fixedpoint.

Invoked Passes

fixedpoint_simp(2) - Max-2 Fixed-point Simplification

Standard simplification pipeline.

Opt level is capped at 2

Text-proto

Options Set

Run to a fixedpoint.

Cap opt level: 2

Invoked Passes

fixedpoint_simp(3) - Max-3 Fixed-point Simplification

Standard simplification pipeline.

Opt level is capped at 3

Text-proto

Options Set

Run to a fixedpoint.

Cap opt level: 3

Invoked Passes

fixedpoint_simp(>=1,<=2) - Min-1 Max-2 Fixedpoint Simplification

Standard simplification pipeline.

Opt level is capped at 2 and skipped if less than 1

Text-proto

Options Set

Run to a fixedpoint.

Min opt level: 1

Cap opt level: 2

Invoked Passes

full-inlining - full function inlining passes

Fully inline all functions in a single step.

Text-proto

Invoked Passes

ident_remove - Identity Removal

class IdentityRemovalPass eliminates all identity() expressions by forward substituting it's parameters to the uses of the identity's def.

Header

inlining - Inlines invocations

Inlines a package toward the top function/proc.

If full then all functions are inlined into the top.

If leaf then only leaf functions are inlined into their caller. This allows other passes to optimize on smaller graphs.

Header

label-recovery - LabelRecovery

At the end of the pass pipeline (when inlining and optimizations have been performed) attempts to recover original names for coverpoints and assertions to whatever degree possible so they're more human-readable -- we mangle them for inlining to ensure they're unique, but often those names are way overqualified.

Header

leaf-inlining - Inlines invocations

Inlines a package toward the top function/proc.

If full then all functions are inlined into the top.

If leaf then only leaf functions are inlined into their caller. This allows other passes to optimize on smaller graphs.

Header

loop_unroll - Unroll counted loops

Header

lut_conversion - LUT Conversion

Pass which opportunistically converts nodes to lookup tables (selects) where we can prove it's beneficial.

Header

map_inlining - Inline map operations

A pass to convert map nodes to in-line Invoke nodes. We don't directly lower maps to Verilog.

Header

narrow - Narrowing

A pass which reduces the width of operations eliminating redundant or unused bits.

Header

narrow(Context) - Narrowing

A pass which reduces the width of operations eliminating redundant or unused bits.

Header

narrow(OptionalContext) - Narrowing

A pass which reduces the width of operations eliminating redundant or unused bits.

Header

narrow(Range) - Narrowing

A pass which reduces the width of operations eliminating redundant or unused bits.

Header

narrow(Ternary) - Narrowing

A pass which reduces the width of operations eliminating redundant or unused bits.

Header

next_value_opt - Next Value Optimization

Pass which tries to optimize next_value nodes.

Optimizations include: - removing literal predicates on next_value nodes (removing the next_value node if dead), - splitting next_value nodes with select-based values (if small), - splitting next_value nodes with priority_sel-based values, and - splitting next_value nodes with one_hot_sel-based values (where safe).

For best results, first modernizes old-style values on next (...) lines, converting them to next_value nodes.

Header

next_value_opt(3) - max-3 next value optimization

Next value opt capped at 3

Text-proto

Options Set

Cap opt level: 3

Invoked Passes

non_synth_separation - Non-Synthesizable Separation

Separates out non-synthesizable nodes like assert/cover/trace from the main function into a cloned function. Every function effectively has two versions, one with synthesizable nodes and one without. The synthesizable version invokes the non-synthesizable version of its function. This ensures that non-synthesizable uses of values do not affect the optimization of the synthesizable parts of the function.

Header

one-leaf-inlining - leaf function inlining passes

inline one level of functions.

Text-proto

Invoked Passes

post-inlining - Post-inlining passes

Passes performed after inlining

Text-proto

Invoked Passes

post-inlining-opt - post-inlining optimization passes

Passes performed after inlining

Text-proto

Invoked Passes

post-inlining-opt(>=1) - min-1 post-inlining optimization passes

Passes performed after inlining

Text-proto

Options Set

Min opt level: 1

Invoked Passes

pre-inlining - pre-inlining passes

Passes performed before each inlining.

Text-proto

Invoked Passes

proc_state_array_flat - Proc State Array Flattening

Pass which flattens array elements of the proc state into their constituent elements. Tuples are flattened in a different pass. Flattening improves optimizability because each state element can be considered and transformed in isolation. Flattening also gives the scheduler more flexibility; without flattening, each element in the aggregate must have the same lifetime.

Header

proc_state_bits_shatter - Proc State Bits Shattering

Pass which transforms Bits-type elements of the proc state into tuples of components. Only flattens where it can show that doing so will enable dynamic state feedback opportunities later (assuming it's followed by a ProcStateTupleFlatteningPass).

Header

proc_state_narrow - Proc State Narrowing

Pass which tries to minimize the size and total number of elements of the proc state. The optimizations include removal of dead state elements and zero-width elements.

Header

proc_state_opt - Proc State Optimization

Pass which tries to minimize the size and total number of elements of the proc state. The optimizations include removal of dead state elements and zero-width elements.

Header

proc_state_provenance_narrow - Proc State Provenance Narrowing

Pass which tries to minimize the size and total number of elements of the proc state. This pass works by examining the provenance of the bits making up the next value to determine which (if any) bits are never actually modified.

NB This is a separate pass from ProcStateNarrowing for simplicity of implementation. That pass mostly assumes we'll have a range-analysis which this does not need.

Header

proc_state_tuple_flat - Proc State Tuple Flattening

Pass which flattens tuple elements of the proc state into their constituent components. Array elements are flattened in a different pass. Flattening improves optimizability because each state element can be considered and transformed in isolation. Flattening also gives the scheduler more flexibility; without flattening, each element in the aggregate must have the same lifetime.

Header

ram_rewrite - RAM Rewrite

Pass that rewrites RAMs of one type to a new type. Generally this will be some kind of lowering from more abstract to concrete RAMs.

Header

reassociation - Reassociation

Reassociates associative operations to reduce delay by transforming chains of operations to a balanced tree of operations, and gathering together constants in the expression for folding.

Header

recv_default - Receive default value simplification

Optimization which removes useless selects between the data value of a conditional or non-blocking receive and the default value of the receive (all zeros).

Header

resource_sharing - Resource Sharing

Header

select_lifting - Select Lifting

Pass which replace the pattern v = sel (c, array[i], array[j], ...) where all cases of the select reference the same array, to the code z = sel (c, i, j, ...) v = array[z]

Header

select_merge - Select Merging

Header

select_range_simp - Select Range Simplification

Pass which simplifies selects and one-hot-selects. Example optimizations include removing dead arms and eliminating selects with constant selectors. Uses range analysis to determine possible values.

Header

select_simp - Select Simplification

Pass which simplifies selects and one-hot-selects. Example optimizations include removing dead arms and eliminating selects with constant selectors. Uses ternary analysis to determine possible values.

Header

simp - Simplification

Standard simplification pipeline.

This is run a large number of times and avoids many time-consuming analyses.

Text-proto

Invoked Passes

simp(2) - Max-2 Simplification

Standard simplification pipeline.

Opt level is capped at 2

Text-proto

Options Set

Cap opt level: 2

Invoked Passes

simp(3) - Max-3 Simplification

Standard simplification pipeline.

Opt level is capped at 3

Text-proto

Options Set

Cap opt level: 3

Invoked Passes

simp(>=1,<=2) - Min-1 Max-2 Simplification

Standard simplification pipeline.

Opt level is capped at 2 and skipped if less than 1

Text-proto

Options Set

Min opt level: 1

Cap opt level: 2

Invoked Passes

simplify-and-inline - Iteratively inline and simplify

Inlining segment of the pipeline

This is performed to fixedpoint and each run a single layer of the function hierarchy is inlined away.

Text-proto

Options Set

Run to a fixedpoint.

Invoked Passes

sparsify_select - Sparsify Select

The SparsifySelectPass is a type of range analysis-informed dead code elimination that removes cases from selects when range analysis proves that they can never occur. It does this by splitting a select into many selects, each of which covers a single interval from the selector interval set.

Header

strength_red - Strength Reduction

Replaces operations with equivalent cheaper operations. For example, multiply by a power-of-two constant may be replaced with a shift left.

Header

table_switch - Table switch conversion

TableSwitchPass converts chains of Select nodes into ArrayIndex ops. These chains have the form: sel.(N)(eq.X, literal.A, literal.B) sel.(N+1)(eq.Y, sel.(N), literal.C) sel.(N+2)(eq.Z, sel.(N+1), literal.D) And so on. In these chains, eq.X, eq.Y, and eq.Z must all be comparisons of the same value against different literals.

Current limitations: - Either the start or end index in the chain must be 0. - The increment between indices must be positive or negative 1. - There can be no "gaps" between indices. - The Select ops have to be binary (i.e., selecting between only two cases).

Header

token_dependency - Convert data dependencies between effectful operations into token dependencies

Pass which turns data dependencies between certain effectful operations into token dependencies. In particular, transitive data dependencies between receives and other effectful ops are turned into token dependencies whenever no such token dependency already exists.

Header

token_simp - Simplify token networks

Pass that simplifies token networks. For example, if an AfterAll node has operands where one operand is an ancestor of another in the token graph, then the ancestor can be omitted. Similarly, duplicate operands can be removed and AfterAlls with one operand can be replaced with their operand.

Header

useless_assert_remove - Remove useless (always true) asserts

Pass which removes asserts that have a literal 1 as the condition, meaning they are never triggered. Rewires tokens to ensure nothing breaks.

Header

useless_io_remove - Remove useless send/receive

Pass which removes sends/receives that have literal false as their condition. Also removes the condition from sends/receives that have literal true as their condition.

Header