<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks for the reduced test case, I’ll try to take a look by the end of the week.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 20, 2019, at 6:53 PM, Nemanja Ivanovic <<a href="mailto:nemanja.i.ibm@gmail.com" class="">nemanja.i.ibm@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">Finally managed to reduce this to something manageable: <a href="https://godbolt.org/z/Hw529k" class="">https://godbolt.org/z/Hw529k</a></div><div dir="ltr" class=""><br class=""></div><div class="">On line 40 of the output, we have a load-immediate to put zero into R3. Then we spill that value on the next line. And as far as I can tell, we reload it on line 97 before the call to getValueAsBit().<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 7:33 PM Nemanja Ivanovic <<a href="mailto:nemanja.i.ibm@gmail.com" class="">nemanja.i.ibm@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class=""><div class="">I do have a reproducer, but it's not for the faint of heart :)<br class=""></div><div class="">This is from a large and messy C file (Perlbench's regexec.c), reduced by bugpoint down to 1050 lines of IR. Perhaps I can paste it on pastebin.</div><div class=""><br class=""></div><div class="">Just for fun, I added some debug dumps for machine instructions that spill registers (i.e. return non-zero from MachineInstr::getFoldedSpillSize()) that are fed by load-immediates and kill that register. Then I bootstrapped LLVM/Clang/compiler-rt with those dumps. Turns out there are 5692 occurrences of that. I might have more luck reducing one of those files.<br class=""></div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 7:16 PM Quentin Colombet <<a href="mailto:qcolombet@apple.com" target="_blank" class="">qcolombet@apple.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Do you have a reproducer?<br class="">
<br class="">
That shouldn’t happen.<br class="">
<br class="">
> On Feb 20, 2019, at 4:12 PM, Nemanja Ivanovic via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class="">
> <br class="">
> I have encountered a rather odd situation with Greedy where it will end up spilling a register that was populated with a zero (with a trivially rematerializable load-immediate instruction).<br class="">
> In fact, it spills 3 such values (LICM moves stuff out of a loop, register coalescer replaces copies with load-immediates and then Greedy spills them).<br class="">
> <br class="">
> I personally can't think of a situation where a spill (with a reload later presumably) is better than simply rematerializing the value where it would have otherwise been reloaded. To that end, would it be possible for Greedy to simply duplicate the trivially rematerializable instruction at every reload site? Perhaps this is something it would need to query the target for? Perhaps Greedy would be able to call something like TargetInstrInfo::rematerializeValue(MachineInstr &RematMI, MachineBasicBlock::iterator InsertAt) or something along those lines?<br class="">
> _______________________________________________<br class="">
> LLVM Developers mailing list<br class="">
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class="">
</blockquote></div>
</blockquote></div>
</div></blockquote></div><br class=""></body></html>