<div dir="ltr">Oh, ok, I see. So starting from a cmp runs into the same problem as starting from a binaryop would cause for an add reduction.<div><br></div><div>I'm actually not sure why we're doing the walk top-to-bottom - it sounds like the wrong direction if we're looking for the "largest tree".</div><div>It looks like originally we were only looking at phi's, which meant the walk was from the start of the basic block to the last phi. So it made sense when the code was written. But it doesn't really make sense to me now. (Unless it helps in terms of compile-time, somehow?)</div><div><br></div><div>Can we change the direction of the walk?</div><div><br></div><div>Thoughts, anyone else? Hal?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 9:03 PM, Alexey Bataev <span dir="ltr"><<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div dir="auto">
<div>Because we start from top-to-bottom analysis and vectorize the arguments of CmpInst. After that we ran into the second CmpInst, but we already can't do anything with these CmpInsts, because the first CmpInst is vectorized already and we can't recognise
 the min/max pattern. <br>
<br>
Best regards,
<div>Alexey Bataev</div>
</div>
<div><br>
8 февр. 2017 г., в 0:33, Michael Kuperstein <<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>> написал(а):<br>
<br>
</div><div><div class="h5">
<blockquote type="cite">
<div>
<div dir="ltr">Why does it block that?</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 7, 2017 at 1:19 PM, Alexey Bataev <span dir="ltr">
<<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The first option is not suitable, it blocks min/max reduction vectorization.<br>
<br>
Best regards,<br>
Alexey Bataev<br>
<br>
> 8 февр. 2017 г., в 0:09, Michael Kuperstein via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> написал(а):<br>
<div class="m_-7615755274776180045HOEnZb">
<div class="m_-7615755274776180045h5">><br>
> mkuper added a comment.<br>
><br>
>> What should I do then?<br>
><br>
> Short term - maybe nothing?<br>
> Is this patch blocking anything? I understand this is part of the work to support min/max reductions, but why is it necessary? Can we go forward with that without regressing any existing cases?<br>
><br>
> Longer term - it would probably be good to try to come up with a saner, or at least, more principled way to do root selection, that also doesn't cause us to look at instructions several times. I don't think adding more ad-hoc cases (CallInst) is the way to
 go. I'm fairly sure we can come up with other examples like this.<br>
><br>
><br>
> <a href="https://reviews.llvm.org/D29449" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2944<wbr>9</a><br>
><br>
><br>
><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div></div></div>

</blockquote></div><br></div>