add small explanation of why fuel can be useful for debugging

This commit is contained in:
cjkenn 2020-11-20 14:51:29 -05:00 committed by Joshua Nelson
parent ed89d6f643
commit 49069a0233
1 changed files with 4 additions and 2 deletions

View File

@ -65,8 +65,10 @@ current level using `tcx.sess.opts.debugging_opts.mir_opt_level`.
Optimization fuel is a compiler option (`-Z fuel=<crate>=<value>`) that allows for fine grained Optimization fuel is a compiler option (`-Z fuel=<crate>=<value>`) that allows for fine grained
control over which optimizations can be applied during compilation: each optimization reduces control over which optimizations can be applied during compilation: each optimization reduces
fuel by 1, and when fuel reaches 0 no more optimizations are applied. This can help with debugging fuel by 1, and when fuel reaches 0 no more optimizations are applied. The primary use of fuel
and identifying problems with optimizations. is debugging optimizations that may be incorrect or misapplied. By changing the fuel
value, you can bisect a compilation session down to the exact incorrect optimization
(this behaves like a kind of binary search through the optimizations).
MIR optimizations respect fuel, and in general each pass should check fuel by calling MIR optimizations respect fuel, and in general each pass should check fuel by calling
[`tcx.consider_optimizing`][consideroptimizing] and skipping the optimization if fuel [`tcx.consider_optimizing`][consideroptimizing] and skipping the optimization if fuel