On Fri, Jul 27, 2012 at 10:39 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank" class="cremed">hfinkel@anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, 27 Jul 2012 17:31:44 -0700<br>
Preston Briggs <<a href="mailto:preston.briggs@gmail.com" class="cremed">preston.briggs@gmail.com</a>> wrote:<br>
<br>
> On Fri, Jul 27, 2012 at 5:06 PM, Evan Cheng <<a href="mailto:evan.cheng@apple.com" class="cremed">evan.cheng@apple.com</a>><br>
> wrote:<br>
><br>
> >> I wrote a test driver that makes dependence queries along with 100+<br>
> >> tests that exercise most everything.<br>
> >> Again, I'm not sure how to organize all this into a format LLVM<br>
> >> can use.<br>
> ><br>
> > Can they be made into unit tests? The first step is to send the 2<br>
> > files for review. It would be worthwhile to include a few of these<br>
> > tests so folks can get a better idea what they look like and how<br>
> > the analysis can be used. But I don't expect anyone will look<br>
> > through all of them right away.<br>
><br>
> Looking the testing infrastructure document...<br>
> I was thinking in terms of regression tests.<br>
> So far, I've organized the tests into 14 C files,<br>
> translated the C files into 14 .ll files,<br>
> and created result files for each of the 14.<br>
><br>
> Seems odd to throw away the C source and keep only the .ll<br>
> How will people ever understand what's going on?<br>
<br>
</div>You could include the C loop in a comment block in the .ll file.</blockquote><div><br></div><div>While this is helpful, I find that the most useful thing to make useful '.ll' tests is to really heavily hand modify them.</div>
<div><br></div><div>Fundamentally, the IR generated by a proper C frontend has a lot of details, noise, and clutter that simply aren't needed when you are testing a single specific feature.</div><div><br></div><div>My typical pattern is this:</div>
<div><br></div><div>1) Write C code and run it through a frontend to get a good "representative" IR formation for the loop or structure under test.</div><div>2) Hand minimize the IR down to the bare essentials for the construct I'm testing. This usually involves removing attributes, alignment, metadata, etc etc.</div>
<div>3) Flesh out this minimal IR with more human-friendly names, often leveraging the domain terminology (such as the common lexicon used for referring to elements of naturally structured loops).</div><div>4) Add comments about the structural entities being tested. I find that for loops ASCII art actually is brilliant in the comments.</div>
<div><br></div><div>The comments you add in #4 also then form excellent context for adding comment-wrapped FileCheck assertions on what the expected results are. <br></div></div></div>