<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 5:40 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="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I’ve come up with something that appears to be working for me on Windows using a python script to do the intermediate piping, but I have serious reservations
about trusting python’s subprocess for cross-platform portability. Have they fixed that yet?</span></p></div></div></blockquote><div><br></div><div>Python's subprocess module is extremely robust in my experience (having used it across platforms, including windows, recently).</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><a name="m_-4363702745314320250__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><a name="m_-4363702745314320250______replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Reid Kleckner [mailto:<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>]
<br>
<b>Sent:</b> Wednesday, April 06, 2016 4:40 PM<br>
<b>To:</b> Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Calling a script from a script in a lit test<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">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:<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">; RUN: grep BISECT %s | sed -e 's/^.*BISECT: //' > %t.sh<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">; RUN: python .../bisect ... %t.sh<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">; BISECT: opt -O2 ...<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">define void @foo() { ret void }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Apr 6, 2016 at 2:34 PM, Kaylor, Andrew via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<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>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></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></div>