<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</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 6 Apr 2017, at 21:06, Ahmed Bougacha <<a href="mailto:ahmed.bougacha@gmail.com" class="">ahmed.bougacha@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">On
 Thu, Apr 6, 2017 at 6:53 AM, Kristof Beyls via llvm-dev</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class=""><</span><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">llvm-dev@lists.llvm.org</a><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">>
 wrote:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
I've been digging a little bit deeper into the biggest performance<br class="">
regressions I've observed.<br class="">
<br class="">
What I've observed so far is:<br class="">
* A lot of the biggest regressions are caused by unnecessarily moving<br class="">
floating point values through general purpose registers. I've raised<br class="">
<a href="http://bugs.llvm.org/show_bug.cgi?id=32550" class="">http://bugs.llvm.org/show_bug.cgi?id=32550</a><span class="Apple-converted-space"> </span>for this. I think this one<br class="">
definitely needs fixing before enabling GlobalISel by default at -O0.<br class="">
* FastISel seems to transform division-by-constant-power-of-2 into right<br class="">
shift (see<br class="">
<a href="https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/SelectionDAG/FastISel.cpp#L456-L468" class="">https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/SelectionDAG/FastISel.cpp#L456-L468</a>).<br class="">
GlobalISel does not. It seems to me that at -O0 there may be reasons not<br class="">
perform this transformation, but maybe there is a good reason why FastISel<br class="">
does this?<br class="">
</blockquote>
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">So,
 FastISel on AArch64 isn't really an "O0" selector:  it has a lot</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">of
 smarts and peepholes, because some JIT users had it as the main</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">optimizing
 selector for a while.</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">In
 that sense, it's a pretty aggressive target that IMO we don't have to match.</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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>
</blockquote>
<div><br class="">
</div>
<div>OK, that makes sense to me now, and indeed it doesn't seem a good idea to try and do lots</div>
<div>of peepholes at -O0.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
* FastISel doesn't seem to handle functions with switch statements, so it<br class="">
falls back to DAGISel. DAGISel produces code that's a lot better than<br class="">
GlobalISel for switch statement at -O0. I'm not sure if we need to do<br class="">
something here before enabling GlobalISel by default. I'm thinking we may<br class="">
need to add a smarter way to lower switch statements rather than just a<br class="">
cascaded sequence of conditional branches.<br class="">
</blockquote>
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">D31080
 seems promising, I've been wanting to take a look, hoping we</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">can
 use that to emit an optimized lowering.  I'm not sure we want that</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">at
 O0 though (even if only for FastISel+DAGISel parity).</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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>
</blockquote>
<div><br class="">
</div>
<div>I wasn't aware of D31080: good to know!</div>
<div>My thinking here is that one of the reasons people use -O0 is they want a pretty straightforward</div>
<div>mapping between source code and the generated assembly code. For switch statements,</div>
<div>mapping to a cascaded sequence of conditional branches, a jump table, a binary search tree,</div>
<div>or any of the other ways to lower switch statements is equally good from this</div>
<div>perspective, I think. So if one of these other lowering schemes is as good as a cascaded sequence</div>
<div>of branches for aspects such as compile time and debug info quality, I think it's best to choose</div>
<div>one of these alternative lowering schemes.</div>
<span class="">It seems to me that e.g. on </span><span class="">MultiSource/Applications/sqlite3/sqlite3, this may be the cause</span></div>
<div><span class="">of the almost 2x slowdown compared to non-globalisel -O0.<br class="">
</span><span class=""><br class="">
</span>
<blockquote type="cite" class="">
<div class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
I'll try to add the above content to the document Diana created at<br class="">
<a href="https://goo.gl/IS2Bdw" class="">https://goo.gl/IS2Bdw</a><span class="Apple-converted-space"> </span>too.<br class="">
</blockquote>
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">Thanks
 for the investigation!  These are also some of the biggest</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">problems
 I've seen (in particular the FP regbanks).</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">I'll
 make sure I find the time to file bugs for all the other issues</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">I'm
 aware of.  (sorry I haven't done that earlier!)</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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>
</blockquote>
<div><br class="">
</div>
<div>I've seen you added 2 bugs so far. I've slotted them in to <a href="https://goo.gl/IS2Bdw" class="">https://goo.gl/IS2Bdw</a>.</div>
<div>I'm starting to think that it may be easiest if we had a "Meta bug" in bugzilla that combines</div>
<div>all the issues we think should be fixed before GlobalISel can be enabled by default at -O0</div>
<div>for AArch64. In the same style as e.g. <a href="http://bugs.llvm.org/show_bug.cgi?id=32061" class="">http://bugs.llvm.org/show_bug.cgi?id=32061</a>.</div>
<div><br class="">
</div>
<div>What do you think?</div>
<div><br class="">
</div>
<div>Thanks!</div>
<div><br class="">
</div>
<div>Kristof</div>
<br class="">
<blockquote type="cite" class="">
<div class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">-Ahmed</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
<blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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="">
Thanks,<br class="">
<br class="">
Kristof<br class="">
<br class="">
<br class="">
<br class="">
On 3 Apr 2017, at 17:10, Kristof Beyls <<a href="mailto:Kristof.Beyls@arm.com" class="">Kristof.Beyls@arm.com</a>> wrote:<br class="">
<br class="">
I've kicked off a run to compare "-O0 -g" versus "-O0 -g -mllvm -global-isel<br class="">
-mllvm -global-isel-abort=2".<br class="">
I've selected the test-suite (albeit a version which is a couple of months<br class="">
old now) and a few short-running proprietary benchmarks to get data back<br class="">
quickly for an initial feel of where things are.<br class="">
This was running on Cortex-A57 AArch64 Linux.<br class="">
<br class="">
I saw one assertion failure in GlobalISel, see<br class="">
<a href="http://bugs.llvm.org/show_bug.cgi?id=32471" class="">http://bugs.llvm.org/show_bug.cgi?id=32471</a>. This is in a program compiled at<br class="">
-O2 (my out-dated test-suite still overrides -O0 and instead uses -O for<br class="">
that program). The root cause of the failure seems to be due to LowLevelType<br class="">
not supporting vectors of pointers. I think this demonstrates that for<br class="">
correctness, we should be trying to test more than -O0, or even more than<br class="">
just LLVM-IR produced by clang, as other front-ends could run into this even<br class="">
at -O0.<br class="">
<br class="">
Due to this assertion failure and the infrastructure I used, the numbers<br class="">
below do not include test-suite/MultiSource/Benchmarks results.<br class="">
<br class="">
On the non-correctness aspects, LNT tells me that:<br class="">
- The programs that report execution time, on geomean are about 17% slower.<br class="">
- The programs that report scores, on geomean are about 21% slower.<br class="">
- Code size is up on geomean about 11%.<br class="">
I'm afraid I don't have compile time numbers, nor any feel for debug info<br class="">
quality.<br class="">
<br class="">
I'll need quite a bit more time to dig into the details to come up with<br class="">
something actionable, although the fact that LowLevelType doesn't support<br class="">
vectors of pointers is already actionable.<br class="">
Nevertheless, I thought to share what I see as is, to see if others see<br class="">
similar results so far.<br class="">
<br class="">
I thought Diana was going to look into fallback rate on the test-suite on<br class="">
AArch64 linux?<br class="">
<br class="">
Thanks,<br class="">
<br class="">
Kristof<br class="">
<br class="">
On 30 Mar 2017, at 10:54, Renato Golin <<a href="mailto:renato.golin@linaro.org" class="">renato.golin@linaro.org</a>> wrote:<br class="">
<br class="">
On 30 March 2017 at 00:27, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:<br class="">
<br class="">
On iOS we are at 100% pass rate in 00 g for the LLVM test suite, standard<br class="">
benchmarks and unit tests. In about 5% of all functions GlobalIsel falls<br class="">
back to SDIsel.<br class="">
(Kristof Beyls would have the linux numbers.)<br class="">
The self host compiler correctly builds and runs the LLVM test suite in O0.<br class="">
<br class="">
<br class="">
Having done no tests at all on my side, I think we need to have<br class="">
similar numbers on Linux to be able to flip across the board.<br class="">
<br class="">
I don't want to flip it only for Darwin and not Linux, as that will<br class="">
fragment the effort too much.<br class="">
<br class="">
I'll check with Diana and Kristof to know what's the best way forward,<br class="">
but it should be reasonably quick.<br class="">
<br class="">
cheers,<br class="">
--renato<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></blockquote>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>