<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 1, 2011, at 9:15 PM, Rafael Ávila de Espíndola wrote:</div></div><div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font><blockquote type="cite">Have you come up with a solution for the problem that<br></blockquote><blockquote type="cite">you can't judge the code size of IR instructions?  I'd like to see a<br></blockquote><blockquote type="cite">more detailed design proposal.<br></blockquote><br>A similar problem exists with the early tail dup at the IL level too.<br></div></blockquote><div><br></div>Right, and we haven't used that pass for at least the last few years.  I'm not sure if that was the reason why it was deprecated like that, but it is a fundamental issue with IR-level tail-dup, not a criticism of your particular implementation.</div><div><br><blockquote type="cite"><div><br><blockquote type="cite">I realize, of course, that I haven't yet provided any details of my<br></blockquote><blockquote type="cite">work, either.  I've got a bunch more pressing things to do this week,<br></blockquote><blockquote type="cite">but I'll try to make progress soon.<br></blockquote><br>BTW, this is the second time you mention this pass to oppose to patch<br>I am working on. The previous time it so happened that my patch<br>helped both webkit and firefox and it has already been committed.<br><br>I always try to send work in progress patches to collect feedback.<br>Would you mind doing the same? If reading your patch I realize it<br>is clearly better, I would be more than happy finish the<br>missing parts. I would also be happy to benchmark the two.<br></div></blockquote><div><br></div>I can't.  I haven't written it yet (at least not to the point where I have anything to share).</div><div><br></div><div>I actually wrote something last year, realized it had a serious flaw in the algorithm, set it aside for a while and then lost all the code.  So now I have to start over….</div><div><br></div><div>I'm just trying to head off what looks like a collision between two projects.  Ideally we can figure out a plan for how to move forward that doesn't involve either of us wasting effort.  If we could agree on an overall plan ahead of time, we can both adjust our efforts to fit into that plan.</div><div><br></div><div>The alternative is that we both go our own ways, end up with 3 or 4 tail dup passes, and then have to throw one or more of them away. That would be a shame, I think.</div><div><br></div><div>I would be willing to implement the indirect branch dup pass that I'm working on at the IR level, except that I don't know how to solve the two problems I mentioned earlier.  If you have ideas for how to solve those, I might be able to build my pass on top of what you're doing now.</div><div><br><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">Sorry, the question was more on the "how to duplicate", not "where<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">to duplicate". If previous optimizations gives us<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">zed: ... br i1 %foo, %indirectgoto, %bar<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">and you decide that the indirect goto should be duplicated to zed,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">how do you do it?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">If you want to duplicate back "zed", you need to duplicate all the<br></blockquote><blockquote type="cite">code between that point and the indirect branch.<br></blockquote><br>Sorry, what is "that point"? the br instruction? The indirectgoto<br>above is the bb created by clang with the indirectbr.</div></blockquote><br></div><div>"that point" would be "zed".  I really don't think I'm understanding your question correctly.  Sorry.</div></body></html>