LIT. tests for OpenMPOpt

Hello,

I am trying to test modifications in OpenMPOpt.CPP. I have written some LIT tests in IR but they are crashing. However the .cpp/.c tests are working.
I checked some related tests already in the test suites:

  1. Why running. opt twice on some parallel region tests?
    ; RUN: opt -S -attributor -openmpopt < %s | FileCheck %s
    ; RUN: opt -S -passes=‘attributor,cgscc(openmpopt)’ < %s | FileCheck %s

  2. Why we are not using -O3 flag? does -openmpopt flag enough for OpenMPOpt?

  3. It does not print any text or statement for debugging

Thanks

1) Why running. opt twice on some parallel region tests?
; RUN: opt -S -attributor -openmpopt < %s | FileCheck %s
; RUN: opt -S -passes='attributor,cgscc(openmpopt)' < %s | FileCheck %s

The first line is testing with the legacy pass manager (at least this
was the idea at some point, with EXPERIMENTAL_NEW_PASS_MANAGER=ON flag
it tries to use the new pass manager even when using the legacy pass
manager command line interface), the latter with the new pass manager.
It is typical to have multiple run lines to run the same test input
with different options.

2) Why we are not using -O3 flag? does -openmpopt flag enough for OpenMPOpt?

-O3 would add many other passes to the pass manager, but this test is
meant to only test the attributor. Add unrelated passes would render
the test very flaky as any change of these could cause this test to
fail.

Testing with -O3 would be more akin to an end-to-end test, which is
what we do with the llvm-test-suite.

3) It does not print any text or statement for debugging

Tests are not supposed to check debug output. Debug output is meant to
help to find an issue, i.e humans-readable, whereas regression tests
only check the (machine-readable) output. To get more detailed debug
output, you might want to add more LLVM_DEBUG(dbgs() << ...) which, if
checked in regression tests, would cause tests to break.

Unfortunately we do have many tests that also check debug output.

Michael

Thanks.

My understanding is that all the tests available in test/Transform/OpenMP/* should pass. However, I tried and some are failing. E.g., pararllel_deletion.ll is failing. Just want to confirm if I might be doing something wrong.

That is most likely due to the changes you’ve made. All tests currently pass on the bots.

  • Stefan