[llvm-dev] Calling a script from a script in a lit test

Kaylor, Andrew via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 6 14:34:44 PDT 2016


I'm trying to put together some tests for the optimization bisecting feature I'm working on and I've come across a stumbling block trying to accomplish something in a lit test.

I've got an IR file with some simple functions, one of which includes a call to another function that will be inlined during optimization.  I can use this to manually test my new OptBisect class by invoking the existing utils/bisect file in the following way:

    python <llvm_scr_root>/utils/bisect --start=0 --end=200 test.sh %(count)s

with 'test.sh' looking like this:

    opt -O2 -opt-bisect-limit=%1 -S opt-bisect.ll | FileCheck opt-bisect.ll --check-prefix=CHECK-BISECT-INLINE

and 'opt-bisect.ll' looking (more or less) like this:

    ; CHECK-BISECT-INLINE: call i32 @f1()
    define i32 @f1() {
    entry:
      ret i32 0
    }

    define i32 @f2() {
    entry:
      %temp = call i32 @f1()
      ret i32 %temp
    }

>From a command shell that does exactly what I want it to and converges on the inlining optimization.  So my question is, how can I accomplish that same thing in the form of a lit test.  I feel like it's really close, but I don't know (1) how to find utils/bisect properly from the lit test, and (2) how to get the piping at the right level on the run line (or into a secondary script that will work on all platforms.

Can anyone help me out?

Thanks,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160406/3f03876b/attachment.html>


More information about the llvm-dev mailing list