<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">>> </span><span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">The
 SLP vectoriser will fail to vectorise this because it wasn't taught to emit runtime alias analysis checks.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important; color: rgb(0, 0, 0);">></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> </span><span style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.666666984558105px; background-color: rgb(255, 255, 255); display: inline !important;"><span style="caret-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); display: inline !important; font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">It
 likely needs more than that - manually hoisting all the loads and</span><br>
<span style="caret-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); display: inline !important; font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">> adding `restrict` still does not vectorise at `-O3`:</span><br style="caret-color:rgb(0, 0, 0)">
</span><span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> </span><span style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.666666984558105px; background-color: rgb(255, 255, 255); display: inline !important;"><a href="https://gcc.godbolt.org/z/z3KjaYv9d" target="_blank" rel="noopener noreferrer" data-auth="NotApplicable" data-linkindex="0" style="margin: 0px;"><span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">https://gcc.godbolt.org/z/z3KjaYv9d</span></a></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hmmm, but it does at -O2 and not too bad from a first quick look. I don't know what that tells us though (haven't looked into details), but at O2 it does look like the SLP vectoriser is kicking in?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">> </span><span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">I'm
 afraid I have to disagree - GVNHoist already does all the hoisting</span><br>
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> we need, in that se</span><span style="caret-color: rgb(0, 0, 0); font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 11pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">​</span><span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">nse
 the mini-GVNhoist is not something to</span><br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> integrate, but a simpler alternative.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The way I look at this is that we could have different modes for GVNHoist. Your simple GVN hoist could be the normal/cheap mode: simpler and more compile-time friendly, slightly less optimal results. In aggressive mode (the current stuff in GVNHoist), it could
 spend more compile time on more optimal results. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> If we put the issue of dealing with masked loads and stores
 in</span><br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> vectorisers aside, I see these approaches:</span><br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> * improve on the mini-GNVhoist as part of GVN (current proposal)</span><br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> * bring GVNHoist up to snuff</span><br style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); display: inline !important;">> * create a NewGVNHoist on top of NewGVN</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.666666984558105px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important; color: rgb(0, 0, 0);">I am not a big fan of all these pass names like SimplePassName,
 NewPassName, NewerPassName, MiniPassName, etc, which is another reason why I was trying to see if we could integrate this in GVNHoist somehow (and thus for me this would be the first step to "bring GVNHoist up to snuff"). But if people are happy with this
 as part of GVN, I am not going to object of course.</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Momchil Velikov <momchil.velikov@gmail.com><br>
<b>Sent:</b> 15 September 2021 18:04<br>
<b>To:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com><br>
<b>Cc:</b> Momchil Velikov <Momchil.Velikov@arm.com>; llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org>; Philip Reames <listmail@philipreames.com>; florian_hahn@apple.com <florian_hahn@apple.com><br>
<b>Subject:</b> Re: [llvm-dev] [RFC] Simple GVN hoist</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Wed, Sep 15, 2021 at 5:17 PM Sjoerd Meijer <Sjoerd.Meijer@arm.com> wrote:<br>
> The SLP vectoriser will fail to vectorise this because it wasn't taught to emit runtime alias analysis checks.<br>
<br>
It likely needs more than that - manually hoisting all the loads and<br>
adding `restrict` still does not vectorise at `-O3`:<br>
<a href="https://gcc.godbolt.org/z/z3KjaYv9d">https://gcc.godbolt.org/z/z3KjaYv9d</a><br>
<br>
> Philip seems happy with this being part of GVN, and I don't have strong opinions, but GVNHoist seems like the natural place for this. An alternative strategy could thus be to integrate this into GVNHoist, enable it by default but only your simple gvn hoist
 algorithm (and disable the rest). That would perhaps then be a first step to address Philip's unhappiness with GVNHoist and restructure and improve it step by step.<br>
<br>
I'm afraid I have to disagree - GVNHoist already does all the hoisting<br>
we need, in that sense the mini-GVNhoist is not something to<br>
integrate, but a simpler alternative.<br>
<br>
If we put the issue of dealing with masked loads and stores in<br>
vectorisers aside, I see these approaches:<br>
* improve on the mini-GNVhoist as part of GVN (current proposal)<br>
* bring GVNHoist up to snuff<br>
* create a NewGVNHoist on top of NewGVN<br>
</div>
</span></font></div>
</body>
</html>