sunfishcode commented on issue #3258:
This fixes the case of a block branching back to itself, but this code will still infinite loop if it walks into a cycle containing multiple blocks and the entire cycle is unreachable from the entry block.
afonso360 commented on issue #3258:
That's true! And running the fuzzer again with this fix found a example of the situation that you were mentioning.
I've change the approach somewhat, we now do a sort of graph search over predecessors. It is not a full search over all blocks, because we stop searching once we find a block with multiple predecessors. This avoids the situation where we have to visit all blocks in the function for every non local var lookup, which should help a lot with performance.
The original algorithm can deal with these cases where we have multiple predecessors somewhere down the line of predecessors.
I've run the fuzzer on this for the last 2 hours, and it seems to be working as intended.
afonso360 edited a comment on issue #3258:
That's true! And running the fuzzer again with this fix found a example of the situation that you were mentioning.
I've change the approach somewhat, we now do a sort of graph search over predecessors. It is not a full search over all blocks, because we stop searching once we find a block with multiple predecessors. This avoids the situation where we have to visit all blocks in the function for every non local var lookup, which should help a lot with performance.
The original algorithm can deal with these cases where we have multiple predecessors somewhere down the line of predecessors.
I've run the fuzzer on this for the last 2 hours, and it seems to be working as intended. (The other examples were usually found within 5 min)
Last updated: Dec 23 2024 at 13:07 UTC