[PATCH] D121727: [NVPTX] Integrate ptxas to LIT tests

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 13:52:26 PDT 2022


jhenderson added a comment.

Another use case for some sort of "if X" construct (or RUNIF:X etc) is tests that have slightly different behaviours on Windows and Linux. One such example that already exists is in tools\llvm-objdump\X86\source-interleave-prefix-non-windows.test and its Windows equivalent tools\llvm-objdump\X86\source-interleave-prefix-windows.test. It would be great to be able to have the same test, but the behaviour to differ slightly for the specific checks. Using the RUNIF format as an example, it might look like:

  RUN: ... commands to generate some output ... > output.txt
  RUNIF:windows: FileCheck %s --input=output.txt --check-prefix=WINDOWS
  RUNIF:!windows: FileCheck %s --input=output.txt --check-prefix=NON-WINDOWS

Of course, this above has a lot of duplicated code, so it might be nice to make the if an if/else ternary-style. Spitball idea:

  RUN: ... | FileCheck %s --check-prefix={%if windows {WINDOWS} else {NON-WINDOWS}}

The specific case here could become:

  RUN: {%if ptxas {ptxas some-args | FileCheck %s} else true}

Ideally, we'd even allow empty RUN lines, if a substitution on the line evaluates to an empty string, so that the `else true` isn't necessary. Bonus points would allow this if to span multiple lines. Maybe this:

  RUN: {%if feature { \
  RUN:   command1; \
  RUN:   command2 | \
  RUN:   command3}}


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121727/new/

https://reviews.llvm.org/D121727



More information about the llvm-commits mailing list