[llvm] r264431 - [InstCombine] use FileCheck for better checking

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 14:19:35 PDT 2016


It's sparse. :)
If you have suggestions for where the following should go, let me know or
feel free to add to the appropriate docs.

I've been invoking it like this:
utils $ ./update_test_checks.py --tool=../../build/bin/opt
../test/Transforms/InstCombine/zero-point-zero-add.ll

Ie, the script lives under 'llvm/utils', my local copies of opt and llc
live in the usual build dir, and you point the script at some regression
test(s) under 'llvm/test'.

Note: "update_test_checks.py" is supposed to subsume
"update_llc_test_checks.py", but I have not removed the original script
from trunk out of fear that the new script may have bugs for x86 llc that
don't exist in the original.

AFAIK, the best description of the intended workflow comes from Chandler's
initial commit message for the original script:
http://reviews.llvm.org/rL225618

I should probably paraphrase that into the help comments for the script
itself. That help text should also be updated to note that 'llc' is the
default for --tool-binary:

$ ./utils/update_test_checks.py --help
usage: update_test_checks.py [-h] [-v] [--tool-binary TOOL_BINARY]
                             [--function FUNCTION]
                             tests [tests ...]

A test case update script. This script is a utility to update LLVM opt or
llc
test cases with new FileCheck patterns. It can either update all of the
tests
in the file or a single test function.

positional arguments:
  tests

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Show verbose output
  --tool-binary TOOL_BINARY
                        The tool used to generate the test case
  --function FUNCTION   The function in the test file to update


On Fri, Mar 25, 2016 at 2:32 PM, Sean Silva <chisophugis at gmail.com> wrote:

> Do we have any documentation for this script? It would be nice to have
> some examples for how to use it.
>
> On Fri, Mar 25, 2016 at 11:01 AM, Sanjay Patel via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: spatel
>> Date: Fri Mar 25 13:01:23 2016
>> New Revision: 264431
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=264431&view=rev
>> Log:
>> [InstCombine] use FileCheck for better checking
>>
>> (testing script for autogeneration of check lines)
>>
>>
>> Modified:
>>     llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll
>>
>> Modified: llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll?rev=264431&r1=264430&r2=264431&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll
>> (original)
>> +++ llvm/trunk/test/Transforms/InstCombine/zero-point-zero-add.ll Fri Mar
>> 25 13:01:23 2016
>> @@ -1,14 +1,23 @@
>> -; RUN: opt < %s -instcombine -S | grep 0.0 | count 1
>> +; NOTE: Assertions have been autogenerated by update_test_checks.py
>> +; RUN: opt < %s -instcombine -S | FileCheck %s
>>
>>  declare double @abs(double)
>>
>>  define double @test(double %X) {
>> +; CHECK-LABEL: @test(
>> +; CHECK:         [[Y:%.*]] = fadd double %X, 0.000000e+00
>> +; CHECK-NEXT:    ret double [[Y]]
>> +;
>>    %Y = fadd double %X, 0.0          ;; Should be a single add x, 0.0
>>    %Z = fadd double %Y, 0.0
>>    ret double %Z
>>  }
>>
>>  define double @test1(double %X) {
>> +; CHECK-LABEL: @test1(
>> +; CHECK:         [[Y:%.*]] = call double @abs(double %X)
>> +; CHECK-NEXT:    ret double [[Y]]
>> +;
>>    %Y = call double @abs(double %X)
>>    %Z = fadd double %Y, 0.0
>>    ret double %Z
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160325/a51606fb/attachment.html>


More information about the llvm-commits mailing list