Skip to content

Commit da0701b

Browse files
cjkennJoshua Nelson
authored and
Joshua Nelson
committed
add small explanation of why fuel can be useful for debugging
1 parent 8f5a144 commit da0701b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/mir/optimizations.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ current level using `tcx.sess.opts.debugging_opts.mir_opt_level`.
6565

6666
Optimization fuel is a compiler option (`-Z fuel=<crate>=<value>`) that allows for fine grained
6767
control over which optimizations can be applied during compilation: each optimization reduces
68-
fuel by 1, and when fuel reaches 0 no more optimizations are applied. This can help with debugging
69-
and identifying problems with optimizations.
68+
fuel by 1, and when fuel reaches 0 no more optimizations are applied. The primary use of fuel
69+
is debugging optimizations that may be incorrect or misapplied. By changing the fuel
70+
value, you can bisect a compilation session down to the exact incorrect optimization
71+
(this behaves like a kind of binary search through the optimizations).
7072

7173
MIR optimizations respect fuel, and in general each pass should check fuel by calling
7274
[`tcx.consider_optimizing`][consideroptimizing] and skipping the optimization if fuel

0 commit comments

Comments
 (0)