<div dir="ltr"><div>I looked at this again and it appears that while spillAroundUses sets the register as 'dead', there is no checking to see if it's dead in subsequent iterations of the bundle loop. </div><div><br></div><div>Is this intentional?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 7, 2016 at 3:28 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Looks like spillAroundUses is spilling multiple duplicate copies to the stack, for example, with some regs we get 1 storeRegToStack call, for others we get multiple (2-6+) and then these instructions are never eliminated.</div><div><br></div><div>Looking at spillAroundUses it looks like multiple duplicate COPYs are being generated, why? One for each use?</div><div><br></div><div>The reg_bundle holds these multiple copies so that we are iterating over the same exact COPY instructions multiple times, even though each one hits the same spot in the function:</div><div><br></div><div>if (hoistSpill(OldLI, MI)) {</div><div>     MI->getOperand(0).setIsDead();</div><div>     DeadDefs.push_back(MI);</div><div>     continue;</div><div>}</div><div><br></div><div>Even when I add a check:</div><div><br></div><div>if (MI->getOperand(0)->isDead())</div><div>    continue;</div><div><br></div><div>This never checks to true, on the second, third, fourth, etc duplicate.</div><div><br></div><div>Not sure what I'm missing? Can someone give me a brief description of why these multiple COPYs are being written out (storeRegToStack is being called)?</div><div><br></div><div>Thanks.</div><div><br></div></div>
</blockquote></div><br></div>