[llvm] Add option to dump IR to files instead of stderr (PR #66412)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 10:37:33 PDT 2023


================
@@ -0,0 +1,56 @@
+; RUN: rm -rf %t/logs
+
+; Basic dump before and after a single module pass
+
+; RUN: opt %s -disable-output -passes='no-op-module' -ir-dump-directory %t/logs -print-after=no-op-module -print-before=no-op-module
----------------
aeubanks wrote:

relying on specific `find` flags can be not very portable. the following is simpler and probably more portable:
```
 ; RUN: opt %s -disable-output -passes='no-op-module' -ir-dump-directory %t/logs -print-after=no-op-module -print-before=no-op-module
-; RUN: find %t/logs -type f -printf '%P\n' | sort -n | FileCheck %s --check-prefix=SINGLE-PASS
-; SINGLE-PASS: {{[0-9]+}}-[[MODULE_NAME_HASH:[a-z0-9]+]]-module-NoOpModulePass-after.ll
-; SINGLE-PASS: {{[0-9]+}}-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
+; RUN: ls %t/logs | FileCheck %s --check-prefix=SINGLE-PASS
+; RUN: ls %t/logs | count 2
+; SINGLE-PASS-DAG: {{[0-9]+}}-[[MODULE_NAME_HASH:[a-z0-9]+]]-module-NoOpModulePass-after.ll
+; SINGLE-PASS-DAG: {{[0-9]+}}-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
 ; RUN: rm -rf %t/logs
```

https://github.com/llvm/llvm-project/pull/66412


More information about the llvm-commits mailing list