<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>Hi Michael,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>Last year I had a problem with reproducibility that I detected in the generated assembly for the out-of-tree target I was working on that seemed like non-deterministic code generation. There was nothing incorrect in the alternative code being emitted, but it was making me nervous that it was different at all.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>After some investigation it turned out to be a consequence of iterator ordering. The scheduler was working out the prioritisation of basic blocks and there was no issue if one BB had a different priority to another. However, if two BBs had the same priority, the implicit ordering was based on the hash in the map that was being iterated, and this could vary between platform (Windows vs Linux) and between recompiles on the same platform.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>Just a thought, but perhaps you might have a look at how ordering is handled in your BB or MI iterators.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>Michael Zolotukhin via llvm-dev<br><b>Sent:</b> 19 April 2018 07:15<br><b>To:</b> Steven Wu <stevenwu@apple.com><br><b>Cc:</b> llvm-dev <llvm-dev@lists.llvm.org><br><b>Subject:</b> Re: [llvm-dev] Need help reproducing a bug<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks everyone! What are the best tools/techniques to expose such non-deterministic behavior? My hope is to reproduce it on a smaller test (e.g. use some sanitizer and thus make the compiler *fail* when building the test) - Currently these failures only tell me “there is some bug in your code” without any hints where to look for it.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Michael<o:p></o:p></p><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On Apr 18, 2018, at 9:18 PM, Steven Wu <<a href="mailto:stevenwu@apple.com">stevenwu@apple.com</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'><br><br style='caret-color: rgb(0, 0, 0);font-variant-caps: normal;text-align:start;-webkit-text-stroke-width: 0px;word-spacing:0px'><br></span><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>On Apr 18, 2018, at 9:11 AM, Roman Lebedev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br><br>On Wed, Apr 18, 2018 at 5:45 PM, Michael Zolotukhin via llvm-dev<br><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br><br><o:p></o:p></span></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>Hi,<br><br>Recently I committed a change (r330175) that passed all my testing, but<br>failed on several bots. Namely, these are the failed ones:<br><a href="http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/9803">http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/9803</a><br><a href="http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/8173">http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/8173</a><br><a href="http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/18082">http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/18082</a><o:p></o:p></span></p></blockquote><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>Note what *specifically* failed:<br>* compare-compilers compare stage3 and stage4 compilers failed ( 0 secs )<br>* compare-tablegen-inc-files compare stage3 and stage4 Tablegen inc<br>files failed ( 1 secs )<br><br>I.e. it wasn't tests that failed.<o:p></o:p></span></p></blockquote><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'><br>Failing that tests means the compiler doesn't produce deterministic output because the stage3 and stage 4 compiler has to be the same.<br><br>Not sure about LLD test.<br><br>Steven<br><br style='caret-color: rgb(0, 0, 0);font-variant-caps: normal;text-align:start;-webkit-text-stroke-width: 0px;word-spacing:0px'><br></span><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'><br><br><o:p></o:p></span></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>I reverted the change (r330180), but now I’m stuck with how to proceed with<br>it, as I can’t reproduce any of these.<br><br>So far I’ve tried building clang with asan and using this sanitized clang to<br>build clang and lld one more time and run make check - none of these failed<br>on my machine. What else could I try to catch the issue?<br><br>In case you are interested in details and/or want to try to reproduce it,<br>you’ll need to revert r330180 (and thus reapply r330175). The change is<br>about using a new faster SSAUpdater in Jump Threading, more details are<br>available in the phabricator: <a href="https://reviews.llvm.org/D44282">https://reviews.llvm.org/D44282</a>.<br><br>Thanks,<br>Michael<br><br><br><br><br>_______________________________________________<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">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></span></p></blockquote><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>_______________________________________________<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">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></span></p></blockquote></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>