<div dir="ltr">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:<div><br></div><div>; RUN: grep BISECT %s | sed -e 's/^.*BISECT: //' > %t.sh</div><div>; RUN: python .../bisect ... %t.sh</div><div>; BISECT: opt -O2 ...</div><div>define void @foo() { ret void }</div><div><br></div><div>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.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 2:34 PM, Kaylor, Andrew via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> python <llvm_scr_root>/utils/bisect --start=0 --end=200 test.sh %(count)s<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">with ‘test.sh’ looking like this:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> opt -O2 -opt-bisect-limit=%1 -S opt-bisect.ll | FileCheck opt-bisect.ll --check-prefix=CHECK-BISECT-INLINE<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">and ‘opt-bisect.ll’ looking (more or less) like this:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> ; CHECK-BISECT-INLINE: call i32 @f1()<u></u><u></u></p>
<p class="MsoNormal"> define i32 @f1() {<u></u><u></u></p>
<p class="MsoNormal"> entry:<u></u><u></u></p>
<p class="MsoNormal"> ret i32 0<u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> define i32 @f2() {<u></u><u></u></p>
<p class="MsoNormal"> entry:<u></u><u></u></p>
<p class="MsoNormal"> %temp = call i32 @f1()<u></u><u></u></p>
<p class="MsoNormal"> ret i32 %temp<u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Can anyone help me out?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Andy<u></u><u></u></p>
<p class="MsoNormal"><u></u><u></u></p>
</div>
</div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>