November 7, 2025
Pressure cooker: LLVM edition
Machine Scheduler in LLVM – Part II
LLVM picks speed over perfection; ‘pressure’ math sets comments on fire
TLDR: LLVM’s scheduler chooses fast heuristics to lower register and resource pressure, favoring speed over perfect optimization. Comments exploded: pragmatists cheer fewer spills, purists want optimal algorithms and more knobs, while memes roast “pressure sets” and tryCandidate-as-dating-app—why it matters: faster apps and fewer surprise slowdowns.
LLVM’s latest deep dive explains how its machine scheduler picks which instruction goes next using a “profitability check” that favors lower register pressure (how many variables fight over scarce slots) and lower resource pressure (how busy parts of the CPU are). Cool, right? The community promptly split into two camps: pragmatists cheering “speed over perfection,” and purists clutching their pearls over heuristics. One camp argues the fixed comparisons in tryCandidate are what make LLVM fast; the other insists “optimal or bust,” accusing the scheduler of leaving performance on the table. People linked Part I like receipts.
Drama peaked when a commenter declared “register pressure is not a synonym for live intervals,” spawning threads and a flood of memes: pressure sets reimagined as gym memberships, “spill vs fill” as a cooking show, and tryCandidate as a dating app. Hardware folks chimed in, noting both in-order and out-of-order CPUs care about pressures, while app developers begged for fewer surprise slowdowns. The spiciest take: if the heuristic lowers spills, who cares if it’s not perfect? Meanwhile, a rival crew demanded tunables, per-target knobs, and more transparency in PressureDiff. In short, LLVM dropped a technical chapter; the comments turned it into a soap opera.
Key Points
- •The article examines the profitability phase of LLVM’s Machine Scheduler, following prior coverage of legality and feasibility checks.
- •Candidate selection uses tryCandidate with fixed heuristic comparisons, prioritizing lower register pressure and resource pressure.
- •Register pressure is defined by the number of concurrent live intervals, influencing the likelihood of register spills.
- •LLVM tracks pressure via pressure sets (e.g., scalar and vector), aggregating pressure per set rather than per register.
- •The scheduler estimates per-instruction pressure impact using a PressureDiff structure indexed by pressure set ID to compare candidates.