Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / Other / dump-before-after.ll
blob2934a77071a75f7ec97cec2424fa40eb8fb0f489
1 ; RUN: rm -rf %t/logs
3 ; Basic dump before and after a single module pass
5 ; RUN: opt %s -disable-output -passes='no-op-module' -ir-dump-directory %t/logs -print-after=no-op-module -print-before=no-op-module
6 ; RUN: ls %t/logs | FileCheck %s --check-prefix=SINGLE-PASS
7 ; RUN: ls %t/logs | count 2
8 ; SINGLE-PASS-DAG: 0-[[MODULE_NAME_HASH:[a-z0-9]+]]-module-NoOpModulePass-after.ll
9 ; SINGLE-PASS-DAG: 0-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
10 ; RUN: cat %t/logs/*after.ll | FileCheck %s --check-prefix=SINGLE-PASS-CONTENTS
12 ; SINGLE-PASS-CONTENTS: ; *** IR Dump After NoOpModulePass on [module] ***
13 ; SINGLE-PASS-CONTENTS: define void @foo() {
14 ; SINGLE-PASS-CONTENTS:   ret void
15 ; SINGLE-PASS-CONTENTS: }
16 ; SINGLE-PASS-CONTENTS: define void @bar() {
17 ; SINGLE-PASS-CONTENTS: entry:
18 ; SINGLE-PASS-CONTENTS:   br label %my-loop
19 ; SINGLE-PASS-CONTENTS: my-loop:                                          ; preds = %my-loop, %entry
20 ; SINGLE-PASS-CONTENTS:   br label %my-loop
21 ; SINGLE-PASS-CONTENTS: }
23 ; RUN: rm -rf %t/logs
25 ; Dump before and after multiple runs of the same module pass
26 ; The integers preceeding log files represent relative pass execution order,
27 ; but they are not necessarily continuous. That is passes which are run
28 ; but not printed, still increment the count -- leading to gaps in the printed
29 ; integers.
31 ; RUN: opt %s -disable-output -passes='no-op-module,no-op-module,no-op-module' -ir-dump-directory %t/logs -print-after=no-op-module -print-before=no-op-module
32 ; RUN: ls %t/logs | FileCheck %s --check-prefix=MULTIPLE-PASSES
33 ; RUN: ls %t/logs | count 6
34 ; MULTIPLE-PASSES-DAG: 0-[[MODULE_NAME_HASH:[a-z0-9]+]]-module-NoOpModulePass-after.ll
35 ; MULTIPLE-PASSES-DAG: 0-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
36 ; MULTIPLE-PASSES-DAG: 1-[[MODULE_NAME_HASH]]-module-NoOpModulePass-after.ll
37 ; MULTIPLE-PASSES-DAG: 1-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
38 ; MULTIPLE-PASSES-DAG: 2-[[MODULE_NAME_HASH]]-module-NoOpModulePass-after.ll
39 ; MULTIPLE-PASSES-DAG: 2-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
40 ; RUN: rm -rf %t/logs
42 ; Dump before and after multiple passes, of various levels of granularity
44 ; RUN: opt %s -disable-output -passes='no-op-module,cgscc(no-op-cgscc),function(no-op-function),function(loop(no-op-loop)),no-op-module' -ir-dump-directory %t/logs -print-after=no-op-module,no-op-cgscc,no-op-function,no-op-loop -print-before=no-op-module,no-op-cgscc,no-op-function,no-op-loop
45 ; RUN: ls %t/logs | FileCheck %s --check-prefix=MULTIPLE-GRANULAR-PASSES
46 ; RUN: ls %t/logs | count 14
47 ; MULTIPLE-GRANULAR-PASSES-DAG: 0-[[MODULE_NAME_HASH:[a-z0-9]+]]-module-NoOpModulePass-after.ll
48 ; MULTIPLE-GRANULAR-PASSES-DAG: 0-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
49 ; MULTIPLE-GRANULAR-PASSES-DAG: 1-[[MODULE_NAME_HASH]]-scc-[[SCC_FOO_HASH:[a-z0-9]+]]-NoOpCGSCCPass-after.ll
50 ; MULTIPLE-GRANULAR-PASSES-DAG: 1-[[MODULE_NAME_HASH]]-scc-[[SCC_FOO_HASH]]-NoOpCGSCCPass-before.ll
51 ; MULTIPLE-GRANULAR-PASSES-DAG: 2-[[MODULE_NAME_HASH]]-scc-[[SCC_BAR_HASH:[a-z0-9]+]]-NoOpCGSCCPass-after.ll
52 ; MULTIPLE-GRANULAR-PASSES-DAG: 2-[[MODULE_NAME_HASH]]-scc-[[SCC_BAR_HASH]]-NoOpCGSCCPass-before.ll
53 ; MULTIPLE-GRANULAR-PASSES-DAG: 3-[[MODULE_NAME_HASH]]-function-[[FUNCTION_FOO_HASH:[a-z0-9]+]]-NoOpFunctionPass-after.ll
54 ; MULTIPLE-GRANULAR-PASSES-DAG: 3-[[MODULE_NAME_HASH]]-function-[[FUNCTION_FOO_HASH]]-NoOpFunctionPass-before.ll
55 ; MULTIPLE-GRANULAR-PASSES-DAG: 4-[[MODULE_NAME_HASH]]-function-[[FUNCTION_BAR_HASH:[a-z0-9]+]]-NoOpFunctionPass-after.ll
56 ; MULTIPLE-GRANULAR-PASSES-DAG: 4-[[MODULE_NAME_HASH]]-function-[[FUNCTION_BAR_HASH]]-NoOpFunctionPass-before.ll
57 ; MULTIPLE-GRANULAR-PASSES-DAG: 9-[[MODULE_NAME_HASH]]-loop-[[LOOP_NAME_HASH:[a-z0-9]+]]-NoOpLoopPass-after.ll
58 ; MULTIPLE-GRANULAR-PASSES-DAG: 9-[[MODULE_NAME_HASH]]-loop-[[LOOP_NAME_HASH]]-NoOpLoopPass-before.ll
59 ; MULTIPLE-GRANULAR-PASSES-DAG: 10-[[MODULE_NAME_HASH]]-module-NoOpModulePass-after.ll
60 ; MULTIPLE-GRANULAR-PASSES-DAG: 10-[[MODULE_NAME_HASH]]-module-NoOpModulePass-before.ll
61 ; RUN: rm -rf %t/logs
63 define void @foo() {
64     ret void
67 define void @bar() {
68 entry:
69     br label %my-loop
70 my-loop:
71     br label %my-loop