<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 13, 2012, at 6:51 AM, Nuno Lopes wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">- Not really related with your patch, but rather a more broaden question:<span class="Apple-converted-space"> </span><br>Now that the register allocator can rematerialize instructions when the live<span class="Apple-converted-space"> </span><br>intervals are too long (Jakob: please correct if I'm wrong), doesn't it make<span class="Apple-converted-space"> </span><br>sense to actually reuse all computations done in dominating basic blocks?<span class="Apple-converted-space"> </span><br>This patch is looking for opportunities to reuse redundant computations in<span class="Apple-converted-space"> </span><br>adjacent blocks, but I believe we could do it for arbitrary BBs, as long as<span class="Apple-converted-space"> </span><br>one of them dominates the other.<br></span></span></blockquote></div><br><div>LLVM IR optimization passes like LICM, CSE, and GVN generally work like this:</div><div><br></div><div>1. IR optimizer is fully aggressive, ignoring register pressure.</div><div>2. Then a miracle occurs.</div><div>3. Good code comes out.</div><div><br></div><div>We are still working on step 2, but in general IR optimization passes don't need to worry about register pressure.</div><div><br></div><div>/jakob</div><div><br></div></body></html>