1; RUN: opt -debugify-each -O3 -S -o /dev/null < %s 2> %t
2; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
3; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
4
5; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s 2> %t
6; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
7; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
8
9; RUN: opt -debugify-each -instrprof -instrprof -sroa -sccp -S -o /dev/null < %s 2> %t
10; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
11; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
12
13; Verify that debugify each can be safely used with piping
14; RUN: opt -debugify-each -O1 < %s | opt -O2 -o /dev/null
15
16; Check that the quiet mode emits no messages.
17; RUN: opt -disable-output -debugify-quiet -debugify-each -O1 < %s 2>&1 | count 0
18
19; Check that stripped textual IR compares equal before and after applying
20; debugify.
21; RUN: opt -O1 < %s -S -o - | \
22; RUN:   opt -strip -strip-dead-prototypes -strip-named-metadata -S -o %t.before
23; RUN: opt -O1 -debugify-each < %s -S -o - | \
24; RUN:   opt -strip -strip-dead-prototypes -strip-named-metadata -S -o %t.after
25; RUN: diff %t.before %t.after
26
27; Check that stripped IR compares equal before and after applying debugify.
28; RUN: opt -O1 < %s | \
29; RUN:   opt -strip -strip-dead-prototypes -strip-named-metadata | \
30; RUN:   llvm-dis -o %t.before
31; RUN: opt -O1 -debugify-each < %s | \
32; RUN:   opt -strip -strip-dead-prototypes -strip-named-metadata | \
33; RUN:   llvm-dis -o %t.after
34; RUN: diff %t.before %t.after
35
36define void @foo(i32 %arg) {
37  call i32 asm "bswap $0", "=r,r"(i32 %arg)
38  ret void
39}
40
41define void @bar() {
42  ret void
43}
44
45; Verify that the module & function (check-)debugify passes run at least twice.
46
47; MODULE-PASS: CheckModuleDebugify [{{.*}}]
48; MODULE-PASS: CheckModuleDebugify [{{.*}}]
49
50; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
51; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
52; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
53; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
54