8bc847fd41e3475385704bb68d0583029c2cb1e5
[mesa.git] / nir_lower_vars_to_ssa.c
1 /*
2 * Copyright © 2014 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Jason Ekstrand (jason@jlekstrand.net)
25 *
26 */
27
28 #include "nir.h"
29 #include "nir_builder.h"
30 #include "nir_phi_builder.h"
31 #include "nir_vla.h"
32
33
34 struct deref_node {
35 struct deref_node *parent;
36 const struct glsl_type *type;
37
38 bool lower_to_ssa;
39
40 /* Only valid for things that end up in the direct list.
41 * Note that multiple nir_deref_vars may correspond to this node, but they
42 * will all be equivalent, so any is as good as the other.
43 */
44 nir_deref_var *deref;
45 struct exec_node direct_derefs_link;
46
47 struct set *loads;
48 struct set *stores;
49 struct set *copies;
50
51 struct nir_phi_builder_value *pb_value;
52
53 struct deref_node *wildcard;
54 struct deref_node *indirect;
55 struct deref_node *children[0];
56 };
57
58 struct lower_variables_state {
59 nir_shader *shader;
60 void *dead_ctx;
61 nir_function_impl *impl;
62
63 /* A hash table mapping variables to deref_node data */
64 struct hash_table *deref_var_nodes;
65
66 /* A hash table mapping fully-qualified direct dereferences, i.e.
67 * dereferences with no indirect or wildcard array dereferences, to
68 * deref_node data.
69 *
70 * At the moment, we only lower loads, stores, and copies that can be
71 * trivially lowered to loads and stores, i.e. copies with no indirects
72 * and no wildcards. If a part of a variable that is being loaded from
73 * and/or stored into is also involved in a copy operation with
74 * wildcards, then we lower that copy operation to loads and stores, but
75 * otherwise we leave copies with wildcards alone. Since the only derefs
76 * used in these loads, stores, and trivial copies are ones with no
77 * wildcards and no indirects, these are precisely the derefs that we
78 * can actually consider lowering.
79 */
80 struct exec_list direct_deref_nodes;
81
82 /* Controls whether get_deref_node will add variables to the
83 * direct_deref_nodes table. This is turned on when we are initially
84 * scanning for load/store instructions. It is then turned off so we
85 * don't accidentally change the direct_deref_nodes table while we're
86 * iterating throug it.
87 */
88 bool add_to_direct_deref_nodes;
89
90 struct nir_phi_builder *phi_builder;
91 };
92
93 static struct deref_node *
94 deref_node_create(struct deref_node *parent,
95 const struct glsl_type *type, nir_shader *shader)
96 {
97 size_t size = sizeof(struct deref_node) +
98 glsl_get_length(type) * sizeof(struct deref_node *);
99
100 struct deref_node *node = rzalloc_size(shader, size);
101 node->type = type;
102 node->parent = parent;
103 node->deref = NULL;
104 exec_node_init(&node->direct_derefs_link);
105
106 return node;
107 }
108
109 /* Returns the deref node associated with the given variable. This will be
110 * the root of the tree representing all of the derefs of the given variable.
111 */
112 static struct deref_node *
113 get_deref_node_for_var(nir_variable *var, struct lower_variables_state *state)
114 {
115 struct deref_node *node;
116
117 struct hash_entry *var_entry =
118 _mesa_hash_table_search(state->deref_var_nodes, var);
119
120 if (var_entry) {
121 return var_entry->data;
122 } else {
123 node = deref_node_create(NULL, var->type, state->dead_ctx);
124 _mesa_hash_table_insert(state->deref_var_nodes, var, node);
125 return node;
126 }
127 }
128
129 /* Gets the deref_node for the given deref chain and creates it if it
130 * doesn't yet exist. If the deref is fully-qualified and direct and
131 * state->add_to_direct_deref_nodes is true, it will be added to the hash
132 * table of of fully-qualified direct derefs.
133 */
134 static struct deref_node *
135 get_deref_node(nir_deref_var *deref, struct lower_variables_state *state)
136 {
137 bool is_direct = true;
138
139 /* Start at the base of the chain. */
140 struct deref_node *node = get_deref_node_for_var(deref->var, state);
141 assert(deref->deref.type == node->type);
142
143 for (nir_deref *tail = deref->deref.child; tail; tail = tail->child) {
144 switch (tail->deref_type) {
145 case nir_deref_type_struct: {
146 nir_deref_struct *deref_struct = nir_deref_as_struct(tail);
147
148 assert(deref_struct->index < glsl_get_length(node->type));
149
150 if (node->children[deref_struct->index] == NULL)
151 node->children[deref_struct->index] =
152 deref_node_create(node, tail->type, state->dead_ctx);
153
154 node = node->children[deref_struct->index];
155 break;
156 }
157
158 case nir_deref_type_array: {
159 nir_deref_array *arr = nir_deref_as_array(tail);
160
161 switch (arr->deref_array_type) {
162 case nir_deref_array_type_direct:
163 /* This is possible if a loop unrolls and generates an
164 * out-of-bounds offset. We need to handle this at least
165 * somewhat gracefully.
166 */
167 if (arr->base_offset >= glsl_get_length(node->type))
168 return NULL;
169
170 if (node->children[arr->base_offset] == NULL)
171 node->children[arr->base_offset] =
172 deref_node_create(node, tail->type, state->dead_ctx);
173
174 node = node->children[arr->base_offset];
175 break;
176
177 case nir_deref_array_type_indirect:
178 if (node->indirect == NULL)
179 node->indirect = deref_node_create(node, tail->type,
180 state->dead_ctx);
181
182 node = node->indirect;
183 is_direct = false;
184 break;
185
186 case nir_deref_array_type_wildcard:
187 if (node->wildcard == NULL)
188 node->wildcard = deref_node_create(node, tail->type,
189 state->dead_ctx);
190
191 node = node->wildcard;
192 is_direct = false;
193 break;
194
195 default:
196 unreachable("Invalid array deref type");
197 }
198 break;
199 }
200 default:
201 unreachable("Invalid deref type");
202 }
203 }
204
205 assert(node);
206
207 /* Only insert if it isn't already in the list. */
208 if (is_direct && state->add_to_direct_deref_nodes &&
209 node->direct_derefs_link.next == NULL) {
210 node->deref = deref;
211 assert(deref->var != NULL);
212 exec_list_push_tail(&state->direct_deref_nodes,
213 &node->direct_derefs_link);
214 }
215
216 return node;
217 }
218
219 /* \sa foreach_deref_node_match */
220 static void
221 foreach_deref_node_worker(struct deref_node *node, nir_deref *deref,
222 void (* cb)(struct deref_node *node,
223 struct lower_variables_state *state),
224 struct lower_variables_state *state)
225 {
226 if (deref->child == NULL) {
227 cb(node, state);
228 return;
229 }
230
231 switch (deref->child->deref_type) {
232 case nir_deref_type_array: {
233 nir_deref_array *arr = nir_deref_as_array(deref->child);
234 assert(arr->deref_array_type == nir_deref_array_type_direct);
235
236 if (node->children[arr->base_offset]) {
237 foreach_deref_node_worker(node->children[arr->base_offset],
238 deref->child, cb, state);
239 }
240 if (node->wildcard)
241 foreach_deref_node_worker(node->wildcard, deref->child, cb, state);
242 break;
243 }
244
245 case nir_deref_type_struct: {
246 nir_deref_struct *str = nir_deref_as_struct(deref->child);
247 if (node->children[str->index]) {
248 foreach_deref_node_worker(node->children[str->index],
249 deref->child, cb, state);
250 }
251 break;
252 }
253
254 default:
255 unreachable("Invalid deref child type");
256 }
257 }
258
259 /* Walks over every "matching" deref_node and calls the callback. A node
260 * is considered to "match" if either refers to that deref or matches up t
261 * a wildcard. In other words, the following would match a[6].foo[3].bar:
262 *
263 * a[6].foo[3].bar
264 * a[*].foo[3].bar
265 * a[6].foo[*].bar
266 * a[*].foo[*].bar
267 *
268 * The given deref must be a full-length and fully qualified (no wildcards
269 * or indirects) deref chain.
270 */
271 static void
272 foreach_deref_node_match(nir_deref_var *deref,
273 void (* cb)(struct deref_node *node,
274 struct lower_variables_state *state),
275 struct lower_variables_state *state)
276 {
277 nir_deref_var var_deref = *deref;
278 var_deref.deref.child = NULL;
279 struct deref_node *node = get_deref_node(&var_deref, state);
280
281 if (node == NULL)
282 return;
283
284 foreach_deref_node_worker(node, &deref->deref, cb, state);
285 }
286
287 /* \sa deref_may_be_aliased */
288 static bool
289 deref_may_be_aliased_node(struct deref_node *node, nir_deref *deref,
290 struct lower_variables_state *state)
291 {
292 if (deref->child == NULL) {
293 return false;
294 } else {
295 switch (deref->child->deref_type) {
296 case nir_deref_type_array: {
297 nir_deref_array *arr = nir_deref_as_array(deref->child);
298
299 /* This is a child of one of the derefs in direct_deref_nodes,
300 * so we know it is direct.
301 */
302 assert(arr->deref_array_type == nir_deref_array_type_direct);
303
304 /* If there is an indirect at this level, we're aliased. */
305 if (node->indirect)
306 return true;
307
308 if (node->children[arr->base_offset] &&
309 deref_may_be_aliased_node(node->children[arr->base_offset],
310 deref->child, state))
311 return true;
312
313 if (node->wildcard &&
314 deref_may_be_aliased_node(node->wildcard, deref->child, state))
315 return true;
316
317 return false;
318 }
319
320 case nir_deref_type_struct: {
321 nir_deref_struct *str = nir_deref_as_struct(deref->child);
322 if (node->children[str->index]) {
323 return deref_may_be_aliased_node(node->children[str->index],
324 deref->child, state);
325 } else {
326 return false;
327 }
328 }
329
330 default:
331 unreachable("Invalid nir_deref child type");
332 }
333 }
334 }
335
336 /* Returns true if there are no indirects that can ever touch this deref.
337 *
338 * For example, if the given deref is a[6].foo, then any uses of a[i].foo
339 * would cause this to return false, but a[i].bar would not affect it
340 * because it's a different structure member. A var_copy involving of
341 * a[*].bar also doesn't affect it because that can be lowered to entirely
342 * direct load/stores.
343 *
344 * We only support asking this question about fully-qualified derefs.
345 * Obviously, it's pointless to ask this about indirects, but we also
346 * rule-out wildcards. Handling Wildcard dereferences would involve
347 * checking each array index to make sure that there aren't any indirect
348 * references.
349 */
350 static bool
351 deref_may_be_aliased(nir_deref_var *deref,
352 struct lower_variables_state *state)
353 {
354 return deref_may_be_aliased_node(get_deref_node_for_var(deref->var, state),
355 &deref->deref, state);
356 }
357
358 static void
359 register_load_instr(nir_intrinsic_instr *load_instr,
360 struct lower_variables_state *state)
361 {
362 struct deref_node *node = get_deref_node(load_instr->variables[0], state);
363 if (node == NULL)
364 return;
365
366 if (node->loads == NULL)
367 node->loads = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
368 _mesa_key_pointer_equal);
369
370 _mesa_set_add(node->loads, load_instr);
371 }
372
373 static void
374 register_store_instr(nir_intrinsic_instr *store_instr,
375 struct lower_variables_state *state)
376 {
377 struct deref_node *node = get_deref_node(store_instr->variables[0], state);
378 if (node == NULL)
379 return;
380
381 if (node->stores == NULL)
382 node->stores = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
383 _mesa_key_pointer_equal);
384
385 _mesa_set_add(node->stores, store_instr);
386 }
387
388 static void
389 register_copy_instr(nir_intrinsic_instr *copy_instr,
390 struct lower_variables_state *state)
391 {
392 for (unsigned idx = 0; idx < 2; idx++) {
393 struct deref_node *node =
394 get_deref_node(copy_instr->variables[idx], state);
395
396 if (node == NULL)
397 continue;
398
399 if (node->copies == NULL)
400 node->copies = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer,
401 _mesa_key_pointer_equal);
402
403 _mesa_set_add(node->copies, copy_instr);
404 }
405 }
406
407 static void
408 register_variable_uses(nir_function_impl *impl,
409 struct lower_variables_state *state)
410 {
411 nir_foreach_block(block, impl) {
412 nir_foreach_instr_safe(instr, block) {
413 if (instr->type != nir_instr_type_intrinsic)
414 continue;
415
416 nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
417
418 switch (intrin->intrinsic) {
419 case nir_intrinsic_load_var:
420 register_load_instr(intrin, state);
421 break;
422
423 case nir_intrinsic_store_var:
424 register_store_instr(intrin, state);
425 break;
426
427 case nir_intrinsic_copy_var:
428 register_copy_instr(intrin, state);
429 break;
430
431 default:
432 continue;
433 }
434 }
435 }
436 }
437
438 /* Walks over all of the copy instructions to or from the given deref_node
439 * and lowers them to load/store intrinsics.
440 */
441 static void
442 lower_copies_to_load_store(struct deref_node *node,
443 struct lower_variables_state *state)
444 {
445 if (!node->copies)
446 return;
447
448 struct set_entry *copy_entry;
449 set_foreach(node->copies, copy_entry) {
450 nir_intrinsic_instr *copy = (void *)copy_entry->key;
451
452 nir_lower_var_copy_instr(copy, state->shader);
453
454 for (unsigned i = 0; i < 2; ++i) {
455 struct deref_node *arg_node =
456 get_deref_node(copy->variables[i], state);
457
458 /* Only bother removing copy entries for other nodes */
459 if (arg_node == NULL || arg_node == node)
460 continue;
461
462 struct set_entry *arg_entry = _mesa_set_search(arg_node->copies, copy);
463 assert(arg_entry);
464 _mesa_set_remove(arg_node->copies, arg_entry);
465 }
466
467 nir_instr_remove(&copy->instr);
468 }
469
470 node->copies = NULL;
471 }
472
473 /* Performs variable renaming
474 *
475 * This algorithm is very similar to the one outlined in "Efficiently
476 * Computing Static Single Assignment Form and the Control Dependence
477 * Graph" by Cytron et al. The primary difference is that we only put one
478 * SSA def on the stack per block.
479 */
480 static bool
481 rename_variables(struct lower_variables_state *state)
482 {
483 nir_builder b;
484 nir_builder_init(&b, state->impl);
485
486 nir_foreach_block(block, state->impl) {
487 nir_foreach_instr_safe(instr, block) {
488 if (instr->type != nir_instr_type_intrinsic)
489 continue;
490
491 nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
492
493 switch (intrin->intrinsic) {
494 case nir_intrinsic_load_var: {
495 struct deref_node *node =
496 get_deref_node(intrin->variables[0], state);
497
498 if (node == NULL) {
499 /* If we hit this path then we are referencing an invalid
500 * value. Most likely, we unrolled something and are
501 * reading past the end of some array. In any case, this
502 * should result in an undefined value.
503 */
504 nir_ssa_undef_instr *undef =
505 nir_ssa_undef_instr_create(state->shader,
506 intrin->num_components,
507 intrin->dest.ssa.bit_size);
508
509 nir_instr_insert_before(&intrin->instr, &undef->instr);
510 nir_instr_remove(&intrin->instr);
511
512 nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
513 nir_src_for_ssa(&undef->def));
514 continue;
515 }
516
517 if (!node->lower_to_ssa)
518 continue;
519
520 nir_alu_instr *mov = nir_alu_instr_create(state->shader,
521 nir_op_imov);
522 mov->src[0].src = nir_src_for_ssa(
523 nir_phi_builder_value_get_block_def(node->pb_value, block));
524 for (unsigned i = intrin->num_components; i < 4; i++)
525 mov->src[0].swizzle[i] = 0;
526
527 assert(intrin->dest.is_ssa);
528
529 mov->dest.write_mask = (1 << intrin->num_components) - 1;
530 nir_ssa_dest_init(&mov->instr, &mov->dest.dest,
531 intrin->num_components,
532 intrin->dest.ssa.bit_size, NULL);
533
534 nir_instr_insert_before(&intrin->instr, &mov->instr);
535 nir_instr_remove(&intrin->instr);
536
537 nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
538 nir_src_for_ssa(&mov->dest.dest.ssa));
539 break;
540 }
541
542 case nir_intrinsic_store_var: {
543 struct deref_node *node =
544 get_deref_node(intrin->variables[0], state);
545
546 if (node == NULL) {
547 /* Probably an out-of-bounds array store. That should be a
548 * no-op. */
549 nir_instr_remove(&intrin->instr);
550 continue;
551 }
552
553 if (!node->lower_to_ssa)
554 continue;
555
556 assert(intrin->num_components ==
557 glsl_get_vector_elements(node->type));
558
559 assert(intrin->src[0].is_ssa);
560
561 nir_ssa_def *new_def;
562 b.cursor = nir_before_instr(&intrin->instr);
563
564 unsigned wrmask = nir_intrinsic_write_mask(intrin);
565 if (wrmask == (1 << intrin->num_components) - 1) {
566 /* Whole variable store - just copy the source. Note that
567 * intrin->num_components and intrin->src[0].ssa->num_components
568 * may differ.
569 */
570 unsigned swiz[4];
571 for (unsigned i = 0; i < 4; i++)
572 swiz[i] = i < intrin->num_components ? i : 0;
573
574 new_def = nir_swizzle(&b, intrin->src[0].ssa, swiz,
575 intrin->num_components, false);
576 } else {
577 nir_ssa_def *old_def =
578 nir_phi_builder_value_get_block_def(node->pb_value, block);
579 /* For writemasked store_var intrinsics, we combine the newly
580 * written values with the existing contents of unwritten
581 * channels, creating a new SSA value for the whole vector.
582 */
583 nir_ssa_def *srcs[4];
584 for (unsigned i = 0; i < intrin->num_components; i++) {
585 if (wrmask & (1 << i)) {
586 srcs[i] = nir_channel(&b, intrin->src[0].ssa, i);
587 } else {
588 srcs[i] = nir_channel(&b, old_def, i);
589 }
590 }
591 new_def = nir_vec(&b, srcs, intrin->num_components);
592 }
593
594 assert(new_def->num_components == intrin->num_components);
595
596 nir_phi_builder_value_set_block_def(node->pb_value, block, new_def);
597 nir_instr_remove(&intrin->instr);
598 break;
599 }
600
601 default:
602 break;
603 }
604 }
605 }
606
607 return true;
608 }
609
610 /** Implements a pass to lower variable uses to SSA values
611 *
612 * This path walks the list of instructions and tries to lower as many
613 * local variable load/store operations to SSA defs and uses as it can.
614 * The process involves four passes:
615 *
616 * 1) Iterate over all of the instructions and mark where each local
617 * variable deref is used in a load, store, or copy. While we're at
618 * it, we keep track of all of the fully-qualified (no wildcards) and
619 * fully-direct references we see and store them in the
620 * direct_deref_nodes hash table.
621 *
622 * 2) Walk over the list of fully-qualified direct derefs generated in
623 * the previous pass. For each deref, we determine if it can ever be
624 * aliased, i.e. if there is an indirect reference anywhere that may
625 * refer to it. If it cannot be aliased, we mark it for lowering to an
626 * SSA value. At this point, we lower any var_copy instructions that
627 * use the given deref to load/store operations.
628 *
629 * 3) Walk over the list of derefs we plan to lower to SSA values and
630 * insert phi nodes as needed.
631 *
632 * 4) Perform "variable renaming" by replacing the load/store instructions
633 * with SSA definitions and SSA uses.
634 */
635 static bool
636 nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
637 {
638 struct lower_variables_state state;
639
640 state.shader = impl->function->shader;
641 state.dead_ctx = ralloc_context(state.shader);
642 state.impl = impl;
643
644 state.deref_var_nodes = _mesa_hash_table_create(state.dead_ctx,
645 _mesa_hash_pointer,
646 _mesa_key_pointer_equal);
647 exec_list_make_empty(&state.direct_deref_nodes);
648
649 /* Build the initial deref structures and direct_deref_nodes table */
650 state.add_to_direct_deref_nodes = true;
651
652 register_variable_uses(impl, &state);
653
654 bool progress = false;
655
656 nir_metadata_require(impl, nir_metadata_block_index);
657
658 /* We're about to iterate through direct_deref_nodes. Don't modify it. */
659 state.add_to_direct_deref_nodes = false;
660
661 foreach_list_typed_safe(struct deref_node, node, direct_derefs_link,
662 &state.direct_deref_nodes) {
663 nir_deref_var *deref = node->deref;
664
665 if (deref->var->data.mode != nir_var_local) {
666 exec_node_remove(&node->direct_derefs_link);
667 continue;
668 }
669
670 if (deref_may_be_aliased(deref, &state)) {
671 exec_node_remove(&node->direct_derefs_link);
672 continue;
673 }
674
675 node->lower_to_ssa = true;
676 progress = true;
677
678 foreach_deref_node_match(deref, lower_copies_to_load_store, &state);
679 }
680
681 if (!progress)
682 return false;
683
684 nir_metadata_require(impl, nir_metadata_dominance);
685
686 /* We may have lowered some copy instructions to load/store
687 * instructions. The uses from the copy instructions hav already been
688 * removed but we need to rescan to ensure that the uses from the newly
689 * added load/store instructions are registered. We need this
690 * information for phi node insertion below.
691 */
692 register_variable_uses(impl, &state);
693
694 state.phi_builder = nir_phi_builder_create(state.impl);
695
696 NIR_VLA(BITSET_WORD, store_blocks, BITSET_WORDS(state.impl->num_blocks));
697 foreach_list_typed(struct deref_node, node, direct_derefs_link,
698 &state.direct_deref_nodes) {
699 if (!node->lower_to_ssa)
700 continue;
701
702 memset(store_blocks, 0,
703 BITSET_WORDS(state.impl->num_blocks) * sizeof(*store_blocks));
704
705 assert(node->deref->var->constant_initializer == NULL);
706
707 if (node->stores) {
708 struct set_entry *store_entry;
709 set_foreach(node->stores, store_entry) {
710 nir_intrinsic_instr *store =
711 (nir_intrinsic_instr *)store_entry->key;
712 BITSET_SET(store_blocks, store->instr.block->index);
713 }
714 }
715
716 node->pb_value =
717 nir_phi_builder_add_value(state.phi_builder,
718 glsl_get_vector_elements(node->type),
719 glsl_get_bit_size(node->type),
720 store_blocks);
721 }
722
723 rename_variables(&state);
724
725 nir_phi_builder_finish(state.phi_builder);
726
727 nir_metadata_preserve(impl, nir_metadata_block_index |
728 nir_metadata_dominance);
729
730 ralloc_free(state.dead_ctx);
731
732 return progress;
733 }
734
735 bool
736 nir_lower_vars_to_ssa(nir_shader *shader)
737 {
738 bool progress = false;
739
740 nir_foreach_function(function, shader) {
741 if (function->impl)
742 progress |= nir_lower_vars_to_ssa_impl(function->impl);
743 }
744
745 return progress;
746 }