Predication bug in AggressiveAntiDepBreaker?


I wondered whether the AggressiveAntiDepBreaker can properly handle predicated instructions.

At the end of PrescanInstruction the "DefIndices" array is updated with the destination register without checking whether the instruction is predicated. That shortens the live range: Later on, in HandleLastUse we check whether the register IsLive, which considers only "KillIndices" and "DefIndices", and therefore returns False for the interval between the predicated instruction and any non-predicated read before it. So that read is considered the last use.
In my example this leads to a register not being fully renamed everywhere.

I don't think a predicated write should count as a define.

The attached patch fixes this test case.

Or am I missing something target dependent here?

AggressiveAntiDepBreaker predication patch.txt (548 Bytes)