36 Pass Pipeline
A pass pipeline is an ordered, nested program of compiler passes. Its order is a semantic design: each pass consumes the invariants produced by earlier passes and establishes prerequisites for later ones.
36.1 Order Encodes Representation Strategy
A typical pipeline performs high-level simplification and shape analysis before lowering structured computation, then converts types and dialects, then applies target cleanup. Lowering early may erase useful tensor or loop structure; lowering late may leave operations the target cannot accept. The right order is the one that preserves the information each next pass needs.
Pipelines can nest scopes, for example a module pass containing function passes. This allows interprocedural setup at module scope and local optimization at function scope. It also determines concurrency and analysis lifetime.
36.2 Debug Pipelines As Stages
When a pipeline fails, inspect IR after the last successful stage and identify the first operation that violates the next pass’s precondition. Use explicit pass names, verification, and IR printing rather than treating the whole pipeline as a black box. A reproducible pipeline should register every pass and dialect it needs, not rely on tool-global defaults.