File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -132,11 +132,17 @@ let use_mark_to_inline_temporaries = object (self)
132132 b.node.name = " scrut" ||
133133 Structs. should_rewrite b.typ = NoCopies
134134 ) &&
135- v = AtMost 1 && (
136- is_readonly_c_expression e1 &&
137- safe_readonly_use e2 ||
138- safe_pure_use e2
139- ) (* || is_readonly_and_variable_free_c_expression e1 && b.node.mut *)
135+ (v = AtMost 1 && (
136+ is_readonly_c_expression e1 &&
137+ safe_readonly_use e2 ||
138+ safe_pure_use e2
139+ ) ||
140+ is_readonly_and_variable_free_c_expression e1 && not b.node.mut)
141+ (* b.node.mut is an approximation of "the address of this variable is taken"
142+ -- TODO this is somewhat incompatible with the phase that changes size-1
143+ arrays into variables who address is taken, so we should also check beore
144+ inlining that the address of this variable is not taken... this is
145+ starting to be quite an expensive check! *)
140146 then
141147 (* Don't drop a potentially useful comment into the ether *)
142148 let e1 = { e1 with meta = e1.meta @ b.meta } in
You can’t perform that action at this time.
0 commit comments