-
Notifications
You must be signed in to change notification settings - Fork 284
Description
An instructiont has a field function which contains the name of the function it is part of. When inlining a function, the inlined instructions retain the original value in the function field. I guess the reason for this mainly has to do with loops, as a loop id is function+"."+loop_number. Then even after the partial inlining step the loops still have the same loop id, and thus if we specify, e.g., --unwindset "func.0:10" and func is inlined then loop 0 in it can still be recognized and unwound 10 times as requested.
How about we change this behavior to make the function field always contain the function the instruction is currently in? Then things like it1->function== it2->function to check if two instructions are in the same function, or goto_functions.function_map[it->function] to get the goto_functiont the instruction is in would work as expected.
To still be able to recognize loops an additional field loop_function could be added to instructiont which together with loop_number forms the loop id. Then when calling compute_loop_ids() the loop_function field would be set to the current function field, and the loop numbers would also be recomputed.