<div dir="ltr"><div>Got the points that wrapping "path/to/opt" or other commands in a shell works.</div><div><br></div><div>In the first few attempts I already get empty IR output (when `llvm-lit test.ll` passed).</div><div><br></div><div>Now I think it's intended possibly because `llvm-reduce` helps to reduce code size and highlight code blocks when IR doesn't work as intended (e.g..crashes).</div><div><br></div><div>So I should define what's interesting (important instructions) for a IR that passes the unit test.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 18, 2021 at 10:47 AM Arthur Eubanks <<a href="mailto:aeubanks@google.com">aeubanks@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I usually end up writing a short bash script which runs `path/to/opt $@ -foo |& grep 'the error/assert message'` and use that as the interestingness test</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 18, 2021 at 10:43 AM Michael Kruse via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am Do., 18. Nov. 2021 um 12:34 Uhr schrieb Mingming Liu via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>:<br>
> I'm a little confused how the custom script (specified by --test arg) tells llvm-reduce if something is interesting in the IR.<br>
><br>
> Is it a common practice to wrap "llvm-lit <IR>" into a shell script to simplify IR for a unit test?<br>
<br>
Yes, it is expected that you write your own "interesting-ness" script.<br>
However I don't think you can use llvm-lit (which requires a `RUN:`<br>
command comment in the file that llvm-reduce does not emit). Instead,<br>
take the command that llvm-lit would execute (Execute with -v flag)<br>
and instead of the test file (%s in the `RUN: ` command), pass $1 to<br>
the opt/llc executable within your script. Check whether it has failed<br>
with `%?`.<br>
<br>
Michael<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><font color="#555555" face="sans-serif" size="2">Thanks,</font></div><div><font color="#555555" face="sans-serif" size="2">Mingming</font></div></div></div></div></div></div></div>