Talk:Copy propagation

Is there a name/optimization technique for copy propagation performed in reverse? ie) add r1, r0, r0; mov r0, r1; -> add r0, r0, r0 Themania (talk) 20:01, 22 June 2008 (UTC)

@Themania: this is an example of constant propagation.

@kdcooper: Actually, this transformation might be better viewed as an instance of getting the assignment (of values to registers) right. In the graph-coloring register allocation world, this kind of thing might be handled with copy coalescing; another, simpler way of handling it would be via biased coloring. In that approach, the decision is made when the register allocator is looking for a place to keep the result of the add operation. The allocator would check to see if that live range is connected by a copy to any other live range and would try to select the color of that other live range. The result is the same. — Preceding unsigned comment added by Kdcooper (talk • contribs) 19:03, 21 April 2015 (UTC)

Copy prop combined with other passes
Ancedotally I've seen at least one production (shader) compiler that propagates fabs/fneg/fsat modifiers as part of a sophisticated copyprop pass. I'm not sure if this is described in the literature and belongs here, but it's worth noting copyprop isn't -just- about pure copies. Arzg (talk) 03:33, 23 March 2021 (UTC)