https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71947
--- Comment #11 from Jeffrey A. Law <law at redhat dot com> --- So I don't like the pain of trying to fold at each propagation step. Specifically, the structure of the gimple statement can change, which invalidates the operand cache. And the canonicalization of operands based on their SSA_NAME_VERSIONs means it's possible to get cycles. While I've got something that appears to work, I'm not at all happy with it. So I started looking at a different approach. Just keep a record of copy propagated objects and if we've already propagated A for B, don't copy propagate B for A in the same statement. We can do this with a bitmap, but that's a lot of overhead, even when lazily initialized. I suspect this matters so rarely in practice that a single entry "this was the last thing copy propagated" is sufficient.