Commit Graph

3 Commits

Author SHA1 Message Date
Pietro Fezzardi 7edfffbbf8 DuplicateReferences: fix for chains of IsRef ops
The previous implementation was iterating on the instructions in order.
This caused problems when we had two instructions, A and B, both tagged
IsRef, and B was using A and B had 2 or more uses.
In this case the pass was looking at A before looking at B, so A was not
duplicated because it only had one use (B).
Then B was analyzed and it had 2 uses so it was duplicated, causing the
number of uses of A to increase accordingly.

This commit fixes the problem iterating on the BasicBlocks in post
order, and on the instruction list in reverse order.

It also fixes MarkAssignments.cpp not to erroneously mark instructions
that are marked IsRef.
2023-02-08 18:12:53 +01:00
Antonio Frighetto 9a08671dae DuplicateReferences: support segmentRef call 2022-07-19 13:49:58 +02:00
Alvise de Faveri d98db76ce1 IRCanonicalization: Add DuplicateReferences pass
This pass adds robustness to the IRCanonicalization pipeline. It
ensures that no reference opcode has more than one use.
2022-06-28 10:30:32 +02:00