<div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 13, 2012 at 1:14 PM, Pranav Bhandarkar <span dir="ltr"><<a href="mailto:pranavb@codeaurora.org" target="_blank" class="cremed">pranavb@codeaurora.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Just adding to the clamor for FileChecks ability to pattern match out-of-order (match for mere presence); Just in the last 2 weeks, I have come across at least a couple instances when I was unable to add small unit tests to the testsuite because of this deficiency in FileCheck. Also, I agree with Krzysztof about the lack of any real recurring overhead.</span></p>
</div></div></blockquote><div><br></div><div>Can you explain why you were unable to add a small unit test to the testsuite?</div><div><br></div><div>All we have here are claims that missing this feature is blocking something from happening, but neither myself nor several other developers have ever hit a situation where they were unable to test because of missing this.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Can this feature please be added to FileCheck ?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Pranav<u></u><u></u></span></p>
<div class="im"><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><span style="font-size:10.5pt;font-family:Consolas;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p></div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank" class="cremed">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank" class="cremed">llvmdev-bounces@cs.uiuc.edu</a>] <b>On Behalf Of </b>Sergei Larin<br>
<b>Sent:</b> Monday, September 10, 2012 1:16 PM<br><b>To:</b> 'Matthew Curtis'; 'Chandler Carruth'</span></p><div><div class="h5"><br><b>Cc:</b> <a href="mailto:llvmdev@cs.uiuc.edu" target="_blank" class="cremed">llvmdev@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [LLVMdev] teaching FileCheck to handle variations in order<u></u><u></u></div></div><p></p></div></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">My 2c:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I think that ability to pattern match “out-of-order” in tests is critical. I currently have to disable instruction scheduling on several Hexagon tests in order to preserve “expected” order of patterns, which has nothing to do with actual correctness of the test… So if nothing else, scheduler is left untested for those cases. Needless to say, this feature must maintain status quo for all existing tests, and only introduce “new” functionality for future, or selected existing tests.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Sergei Larin<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:#1f497d">---<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><span style="font-size:10.5pt;font-family:Consolas;color:#1f497d"><u></u><u></u></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank" class="cremed">llvmdev-bounces@cs.uiuc.edu</a> <a href="mailto:[mailto:llvmdev-bounces@cs.uiuc.edu]" target="_blank" class="cremed">[mailto:llvmdev-bounces@cs.uiuc.edu]</a> <b>On Behalf Of </b>Matthew Curtis<br>
<b>Sent:</b> Monday, September 10, 2012 9:28 AM<br><b>To:</b> Chandler Carruth<br><b>Cc:</b> <a href="mailto:llvmdev@cs.uiuc.edu" target="_blank" class="cremed">llvmdev@cs.uiuc.edu</a><br><b>Subject:</b> Re: [LLVMdev] teaching FileCheck to handle variations in order<u></u><u></u></span></p>
</div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On 9/7/2012 4:08 PM, Chandler Carruth wrote:<u></u><u></u></p></div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><div><p class="MsoNormal">
On Fri, Sep 7, 2012 at 8:20 AM, Matthew Curtis <<a href="mailto:mcurtis@codeaurora.org" target="_blank" class="cremed">mcurtis@codeaurora.org</a>> wrote:<u></u><u></u></p><div><p class="MsoNormal">Hello all,<br><br>
For the hexagon target, we have a couple of tests that are failing due to variations in the order of checked text. In these cases the ordering is not directly relevant to the functionality being tested.<br><br>For example:<u></u><u></u></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">; CHECK: memw(##a)</span></tt><br><tt><span style="font-size:10.0pt">; CHECK: memw(##b)</span></tt><br><br><tt><span style="font-size:10.0pt">%0 = load i32* @a, align 4</span></tt><br>
<tt><span style="font-size:10.0pt">%1 = load i32* @b, align 4</span></tt><u></u><u></u></p><p class="MsoNormal">requires that the compiler emit the memory operations for 'a' and 'b' in that order, even though the intent of the test might simply be to ensure that each 'load' results in a memory read.<br>
<br>I'd like to teach FileCheck to allow tests to be more tolerant of these incidental variations.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">So, I'm not a huge fan of this, but for a strange reason.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Fundamentally, I agree with you that these ordering dependencies are unfortunate in tests. However, I would make a few observations:<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">1) The order of instructions, unlike some things such as register allocation's selection of registers, should ideally not vary much. Currently it does more that we would like due to the inability to unit test single pieces of the backend, but I don't think we should make FileCheck better to cope with that, I think we should fix the underlying problem.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">2) It is usually fairly obvious when two such checks don't actually have an ordering constraint that is important, and where it isn't, a comment makes the intent clear.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">3) By checking the ordering, we gain at least some early detection of non-determinism in the code generator. I definitely caught several bugs in the block placement pass while I was working on it due to this very "feature" of the test suite.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Given these points, the value tradeoff here of making FileCheck *significantly* more complicated (and the tests significantly more complex as well) versus the time savings updating test cases when the ordering changes...<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote><p class="MsoNormal" style="margin-bottom:12.0pt"><br>To be honest, I'm fairly new to LLVM and Clang so I don't have a good feel for how often this will come up. I've encountered two tests over the past month and a half that have regressed due to ordering changes. In one case the order varies based on target, so I would have to duplicate the test and enable/disable one or the other based on target. Not great, but if it's just one test probably acceptable.<br>
<br>As far as complexity, I didn't feel like the complexity added to FileCheck was that significant, though relative to how often the feature would (or should) get used perhaps it is. I was more concerned about adding 2-3 new directives to the user interface. In the end, that acceptable given that users would only see the additional complexity if they needed it.<br>
<br>If no one else feels like they would benefit much from this, I'll probably just wait and see how much of a maintenance burden this really is. If it continues to be an issue I can bring it back up to the community.<br>
<br><u></u><u></u></p><div><div><div><p class="MsoNormal">But maybe others who have spent more time hammering against these problems in the backend have a different sense of the magnitude of the problem?<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><div>
<p class="MsoNormal"><br>The attached patch implements one possible solution. It introduces a position stack and a couple of directives:<u></u><u></u></p><ul type="disc"><li class="MsoNormal">'CHECK-PUSH:' pushes the current match position onto the stack.<u></u><u></u></li>
<li class="MsoNormal">'CHECK-POP:' pops the top value off of the stack and uses it to set the current match position.<u></u><u></u></li></ul><p class="MsoNormal">The above test can now be re-written as:<u></u><u></u></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">; CHECK-PUSH:</span></tt><br><tt><span style="font-size:10.0pt">; CHECK: memw(##a)</span></tt><br><tt><span style="font-size:10.0pt">; CHECK-POP:</span></tt><br><tt><span style="font-size:10.0pt">; CHECK: memw(##b)</span></tt><br>
<br><tt><span style="font-size:10.0pt">%0 = load i32* @a, align 4</span></tt><br><tt><span style="font-size:10.0pt">%1 = load i32* @b, align 4</span></tt><u></u><u></u></p><p class="MsoNormal" style="margin-bottom:12.0pt">
which handles either ordering of memory reads for 'a' and 'b'.<br><br>Thoughts?<br><br>Thanks,<br>Matthew Curtis<span><span style="color:#888888"><u></u><u></u></span></span></p><pre><span style="color:#888888">-- </span><u></u><u></u></pre>
<pre><span style="color:#888888">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></pre></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>
LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank" class="cremed">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank" class="cremed">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><u></u> <u></u></p>
</div><p class="MsoNormal" style="margin-bottom:12.0pt"><br><br><u></u><u></u></p><pre>-- <u></u><u></u></pre><pre>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<u></u><u></u></pre>
</div></div></div></div></div></div></blockquote></div><br></div>