[llvm-commits] [llvm] r67849 - /llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll

Misha Brukman brukman at gmail.com
Mon Mar 30 13:34:59 PDT 2009


On Mon, Mar 30, 2009 at 3:52 PM, Chris Lattner <clattner at apple.com> wrote:

> On Mar 30, 2009, at 11:36 AM, Misha Brukman wrote:
>
> >> @@ -1,4 +1,4 @@
>> >> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
>> >> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {= store}
>> >
>> > I thought that "store" instructions were never assigned to a
>> > variable...
>>
>> This test is grepping through the -debug output of llc, and the stores
>> its
>> looking for do happen to be printed with =.
>>
>> Grepping through -debug output isn't very nice in any case, but at the
>> moment there aren't any better ways to express this specific test.
>>
>
> You can write a unittest to check this.  It might require some refactoring
> to be able to run all of LLC's passes separately from running the tool on
> the command line, since they are currently hard-coded in its main()
> function.
>
> I don't think we want unit tests for passes.  We only want unit tests for
> low level APIs.
>

Let's drop the term "unit" and just call them tests.  I'm proposing we test
passes in C++ instead of a shell script that calls grep.

How else can we check the correctness of a pass, which involves
pattern-matching multiple instructions?  Grep can only look at a single line
at a time, and doesn't have the semantic knowledge of what's an instruction
and what's an operand, whereas we have all this information in C++.

This thread also shows how brittle shell scripts are for testing pass
output, which shouldn't be the case for the LLVM C++ API.

Misha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090330/856c5e86/attachment.html>


More information about the llvm-commits mailing list