Talk:Copy propagation

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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)[reply]

@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 (talkcontribs) 19:03, 21 April 2015 (UTC)[reply]

Copy prop combined with other passes[edit]

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)[reply]