[llvm] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

Nuri Amari via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 12:20:47 PDT 2023


================
@@ -0,0 +1,71 @@
+; RUN: mkdir -p %t/logs
+; 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 -dump-after=no-op-module -dump-before=no-op-module
+; RUN: find %t/logs -type f -print | FileCheck %s --check-prefix=SINGLE-RUN -DSOURCE_FILE_NAME=%s
+; SINGLE-RUN-DAG: [[SOURCE_FILE_NAME]]/0.NoOpModulePass.0-before.ll
----------------
NuriAmari wrote:

The first `0` means this is the first pass to run at this nesting level. The second `0` means this is the first `NoOpModulePass` to run at this nesting level.

While dumping to files is less noisy, without this first number you lose the sequence in which passes run, which makes it harder to trace issues.

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


More information about the llvm-commits mailing list