<div dir="ltr">(staring at this pass, i'm not sure it's supposed to work in all cases on all processors.<div>If it is, it ... uh, needs help :P)</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 10, 2017 at 12:00 PM, Amara Emerson via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This looks like it's due to r301950, which has today been reverted in<br>
r302640. Can you try with the latest trunk?<br>
<br>
Regardless, there seems to be an underlying bug exposed.<br>
<br>
On 10 May 2017 at 07:37, Mikael Holmén via llvm-dev<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Hi,<br>
><br>
> A few days ago I stumbled upon a problem where SpeculativeExecution<br>
> changed the order of a load and a store to the same address.<br>
><br>
> I wrote<br>
><br>
>  <a href="https://bugs.llvm.org//show_bug.cgi?id=32964" rel="noreferrer" target="_blank">https://bugs.llvm.org//show_<wbr>bug.cgi?id=32964</a><br>
><br>
> about it but no response there so far.<br>
><br>
> In the input we have<br>
><br>
>   store i8 0, i8* @i<br>
>   %.pre = load i8, i8* @i<br>
><br>
> and then in the output the load is moved so it's before the store which<br>
> clearly makes it load the wrong value.<br>
><br>
> isSafeToSpeculativelyExecute happily says "true" for the load, and there is<br>
> a comment on isSafeToSpeculativelyExecute saying<br>
><br>
>   /// This method can return true for instructions that read memory;<br>
>   /// for such instructions, moving them may change the resulting value.<br>
><br>
> And that is indeed the case in PR32964.<br>
><br>
> How is this supposed to work?<br>
><br>
> I started seeing this after the commit<br>
><br>
>  SpeculativeExecution: Stop using whitelist for costs<br>
><br>
> Before that, e.g. a load got the cost UINT_MAX which I suppose disabled<br>
> hoisting, but since the commit TTI.getUserCost(I) is used for all<br>
> instructions.<br>
><br>
> Regards,<br>
> Mikael<br>
> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>