On Thu Nov 23 09:38:11 2023 +0000, Giovanni Mascellani wrote:
If I am not mistaken timestamps are monotonic here. I wonder whether a binary search might be more efficient, at least when looking for the load referenced by a swizzle (which might be much earlier in the code). Just thinking loudly, though, I think the code as is is fine until we find evidence of the contrary. It might even be that the binary search is detrimental, if loads referenced by swizzles end up being close to the swizzles themselves. It depends on how much history we have to "unwind" on average.
Yep, the timestamps are strictly monotonic.
A lookup from the newest to the oldest record is the most efficient thing for processing loads because we want the value at the time of the load itself (most recent entry). For swizzles the thing is different but also I don't think it would matter much since I don't expect there to be many records to the same component of the same variable in the same block anyways.
I say "the same block" because the copy_propagation_state is a recursive struct, so if we make a binary search, we would be making it at the level of the block.