@@ -110,26 +110,3 @@ current level using [`tcx.sess.opts.unstable_opts.mir_opt_level`][mir_opt_level]
110
110
111
111
[ compiler MCP ] : https://github.com/rust-lang/compiler-team/issues/319
112
112
[ mir_opt_level ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/config/struct.UnstableOptions.html#structfield.mir_opt_level
113
-
114
- ## Optimization fuel
115
-
116
- Optimization fuel is a compiler option (` -Z fuel=<crate>=<value> ` ) that allows for fine grained
117
- control over which optimizations can be applied during compilation: each optimization reduces
118
- fuel by 1, and when fuel reaches 0 no more optimizations are applied. The primary use of fuel
119
- is debugging optimizations that may be incorrect or misapplied. By changing the fuel
120
- value, you can bisect a compilation session down to the exact incorrect optimization
121
- (this behaves like a kind of binary search through the optimizations).
122
-
123
- MIR optimizations respect fuel, and in general each pass should check fuel by calling
124
- [ ` tcx.consider_optimizing ` ] [ consideroptimizing ] and skipping the optimization if fuel
125
- is empty. There are a few considerations:
126
-
127
- 1 . If the pass is considered "guaranteed" (for example, it should always be run because it is
128
- needed for correctness), then fuel should not be used. An example of this is ` PromoteTemps ` .
129
- 2 . In some cases, an initial pass is performed to gather candidates, which are then iterated to
130
- perform optimizations. In these situations, we should allow for the initial gathering pass
131
- and then check fuel as close to the mutation as possible. This allows for the best
132
- debugging experience, because we can determine where in the list of candidates an optimization
133
- may have been misapplied. Examples of this are ` InstSimplify ` and ` ConstantPropagation ` .
134
-
135
- [ consideroptimizing ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.consider_optimizing
0 commit comments