[llvm-dev] Strip IR metadata information in a unit test

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 18 10:42:56 PST 2021


Am Do., 18. Nov. 2021 um 12:34 Uhr schrieb Mingming Liu via llvm-dev
<llvm-dev at lists.llvm.org>:
> I'm a little confused how the custom script (specified by --test arg) tells llvm-reduce if something is interesting in the IR.
>
> Is it a common practice to wrap "llvm-lit <IR>" into a shell script to simplify IR for a unit test?

Yes, it is expected that you write your own "interesting-ness" script.
However I don't think you can use llvm-lit (which requires a `RUN:`
command comment in the file that llvm-reduce does not emit). Instead,
take the command that llvm-lit would execute (Execute with -v flag)
and instead of the test file (%s in the `RUN: ` command), pass $1 to
the opt/llc executable within your script. Check whether it has failed
with `%?`.

Michael


More information about the llvm-dev mailing list