<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Michael</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 13, 2015, at 11:58 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com" class="">chandlerc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><br class=""></div></div></div></blockquote><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 13, 2015 at 11:52 AM, Michael Zolotukhin <span dir="ltr" class=""><<a href="mailto:mzolotukhin@apple.com" target="_blank" class="">mzolotukhin@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">Thank you for the work and pointing out to the problems! It’s good that we found them early.</div><div class=""><br class=""></div><div class="">I think that we would solve these issues if we do the following:</div><div class="">1. When looking for simplified instructions, visit each instruction only once. That’ll be achieved by visiting blocks in pre-order.</div><div class="">2. When looking for dead-instructions, also visit them only once - here we would need to visit blocks in reverse-order.</div><div class="">3. SCEV indeed might be too slow for this, but we actually only interested in expressions that become constants. That means, we need SCEV for expressions that either feed a load, or have constant Start and Step SCEV-expressions. We can scan all insns once and cache results for such potentially-constant instructions, other instructions don’t need SCEV-expression. So, we won’t need to talk to SCEV after this point.</div><div class="">4. As for using threshold for early-exit - that’s a really good idea, and it should integrate here naturally.</div><div class=""><br class=""></div><div class="">What do you think about this? Am I missing something, or does it sound right?</div></blockquote><div class=""><br class=""></div><div class="">Generally yes, but I would start without trying to handle dead instructions, and following the sketch of how to build it I gave. I would then layer dead instructions on as a follow-up. There are several different approaches to handling dead instructions, and I think it will be useful to see how things look without handling them first.<br class=""></div><div class=""><br class=""></div><div class="">Note that the outline I gave naturally will skip dead *control flow*, because we can simplify the condition to a constant and only traverse one of the successors.</div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>