[llvm-dev] Calling a script from a script in a lit test
Reid Kleckner via llvm-dev
llvm-dev at lists.llvm.org
Wed Apr 6 16:40:17 PDT 2016
Well... last time I wanted to essentially have two files in one in a lit
test, I used grep and sed to split one file, like the following:
; RUN: grep BISECT %s | sed -e 's/^.*BISECT: //' > %t.sh
; RUN: python .../bisect ... %t.sh
; BISECT: opt -O2 ...
define void @foo() { ret void }
This approach isn't going to work on Windows, though, because bash isn't
provided by gnuwin32, and so far we've avoided depending on it directly.
On Wed, Apr 6, 2016 at 2:34 PM, Kaylor, Andrew via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> 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
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160406/e69c56c6/attachment-0001.html>
More information about the llvm-dev
mailing list