On Tue Jun 20 00:50:34 2023 +0000, Francisco Casas wrote:
Most of the code assumes that if "allocated" is set then the variable
is used. It seems like an error that allocate_register_reservations() is setting it even for unused variables. ~~I think you are right. I probably introduced this regression in f8338ef08953686298bb31315a19e6044325bb49, I forgot to skip unused objects in allocate_register_reservations() when I wrote it.~~ ~~Yes, probably the best solution is to add~~
if (!var->last_read || !var->data_type->reg_size[regset]) continue;
~~in allocate_register_reservations().~~
Francisco, is there a reason we're doing that? Why does
get_allocated_object() check that flag? ~~Once that flag is set, the object registers are assumed to be reserved for that variable. allocate_register_reservations() should ensure that flag is set for all **used objects with register reservations** (we clearly have to fix the **used** part), and also allocate_objects() sets it for objects without register reservations, one at the time.~~
No, wait. That's not it. Ignore my previous comment. There is even a test that says: ``` % Register reservations force to reserve all the resource registers. Even if unused. ```
I see now that what we ought to do is ignore overlaps when one of the objects with register reservations is not used. So this MR is correct regarding that.
Ugh, I will answer again then:
Francisco, is there a reason we're doing that? Why does get_allocated_object() check that flag?
We have to make sure that those spaces are reserved, even if the object is not used, like in the test with the previous comment.