Chandler Carruth via llvm-dev
2016-Aug-04 16:48 UTC
[llvm-dev] RFC: We should stop merging allocas in the inliner
On Thu, Aug 4, 2016 at 9:44 AM Joerg Sonnenberger via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Mon, Aug 01, 2016 at 04:47:49AM +0000, Chandler Carruth via llvm-dev > wrote: > > Chris added alloca merging in the inliner a looooong time ago, 2009. The > > reason he added it was because at the time we didn't do stack coloring > and > > without it we had serious stack size problems in LLVM. > > Do we have any way to hunt for stack size regressions? I've been hit by > some serious bugs in this area in GCC in the past and I would prefer to > not repeat that experience with LLVM. >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? 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160804/f2110fae/attachment.html>
Mehdi Amini via llvm-dev
2016-Aug-04 16:56 UTC
[llvm-dev] RFC: We should stop merging allocas in the inliner
> On Aug 4, 2016, at 9:48 AM, Chandler Carruth via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On Thu, Aug 4, 2016 at 9:44 AM Joerg Sonnenberger via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > On Mon, Aug 01, 2016 at 04:47:49AM +0000, Chandler Carruth via llvm-dev wrote: > > Chris added alloca merging in the inliner a looooong time ago, 2009. The > > reason he added it was because at the time we didn't do stack coloring and > > without it we had serious stack size problems in LLVM. > > Do we have any way to hunt for stack size regressions? I've been hit by > some serious bugs in this area in GCC in the past and I would prefer to > not repeat that experience with LLVM. > > 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? > > 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.Are these “clang tricks” some indications of weaknesses in LLVM on this aspect? — Mehdi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160804/003f36d5/attachment.html>
Chandler Carruth via llvm-dev
2016-Aug-04 17:00 UTC
[llvm-dev] RFC: We should stop merging allocas in the inliner
On Thu, Aug 4, 2016 at 9:56 AM Mehdi Amini via llvm-dev < llvm-dev at lists.llvm.org> wrote:> > On Aug 4, 2016, at 9:48 AM, Chandler Carruth via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > On Thu, Aug 4, 2016 at 9:44 AM Joerg Sonnenberger via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> On Mon, Aug 01, 2016 at 04:47:49AM +0000, Chandler Carruth via llvm-dev >> wrote: >> > Chris added alloca merging in the inliner a looooong time ago, 2009. The >> > reason he added it was because at the time we didn't do stack coloring >> and >> > without it we had serious stack size problems in LLVM. >> >> Do we have any way to hunt for stack size regressions? I've been hit by >> some serious bugs in this area in GCC in the past and I would prefer to >> not repeat that experience with LLVM. >> > > 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? > > 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. > > > Are these “clang tricks” some indications of weaknesses in LLVM on this > aspect? >Depends on how you look at it. They're only enabled at O0. 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. 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. Within Clang there are somewhat more obvious repeated patterns that we can target for re-use. 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.> > — > Mehdi > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160804/31a028bb/attachment-0001.html>