<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 4, 2016, at 10:00 AM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" class="">chandlerc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Aug 4, 2016 at 9:56 AM Mehdi Amini via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 4, 2016, at 9:48 AM, Chandler Carruth via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_5416903275673672482Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Aug 4, 2016 at 9:44 AM Joerg Sonnenberger via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">On Mon, Aug 01, 2016 at 04:47:49AM +0000, Chandler Carruth via llvm-dev wrote:<br class="">> Chris added alloca merging in the inliner a looooong time ago, 2009. The<br class="">> reason he added it was because at the time we didn't do stack coloring and<br class="">> without it we had serious stack size problems in LLVM.<br class=""><br class="">Do we have any way to hunt for stack size regressions? I've been hit by<br class="">some serious bugs in this area in GCC in the past and I would prefer to<br class="">not repeat that experience with LLVM.<br class=""></blockquote><div class=""><br class=""></div><div class="">My technique was to log the stack size and build a bunch of code, and then analyze the logs before and after. It seemed really effective though?</div><div class=""><span style="line-height: 1.5;" class=""><br class=""></span></div><div class=""><span style="line-height: 1.5;" class="">I also have some tests (sadly internal) that check stacksize is under some bound and those tend to serve is good indicators that something has gone badly wrong. For example, without the Clang tricks at -O0, we couldn't get their tests to pass.</span></div></div></div></div></blockquote></div><br class=""></div><div style="word-wrap: break-word;" class=""><div class="">Are these “clang tricks” some indications of weaknesses in LLVM on this aspect?</div></div></blockquote><div class=""><br class=""></div><div class="">Depends on how you look at it. They're only enabled at O0.</div></div></div></div></blockquote><div><br class=""></div><div>Oh right, I missed that part. That’s fine then.</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""> It's essentially the lowest compile time cost way to re-use stack space in *highly* repeatative functions (like where you have macros stamping out 1000s of temporary std::string objects). Clang just keeps a freelist around of allocas and re-uses them.</div><div class=""><br class=""></div><div class="">We could always turn on some form of stack coloring at O0, but when we looked at it that would have been much harder to have match the compile time profile, and also harder to make survive debug info etc.</div><div class=""><br class=""></div><div class="">Within Clang there are somewhat more obvious repeated patterns that we can target for re-use.</div><div class=""><br class=""></div><div class="">At least, this is my memory from the discussion with Richard Smith when he implemented this. =] He may want to provide more details or correct my memory of things.</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><br class=""></div><div class="">— </div></div><div style="word-wrap: break-word;" class=""><div class="">Mehdi</div><div class=""><br class=""></div></div>_______________________________________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></blockquote></div></div></div></blockquote></div><br class=""></body></html>