1; This test checks -print-after/before on loop passes 2; Besides of the loop itself it should be dumping loop pre-header and exits. 3; 4; RUN: opt < %s 2>&1 -disable-output \ 5; RUN: -loop-deletion -print-before=loop-deletion \ 6; RUN: | FileCheck %s -check-prefix=DEL 7; RUN: opt < %s 2>&1 -disable-output \ 8; RUN: -passes='loop(loop-deletion)' -print-before=loop-deletion \ 9; RUN: | FileCheck %s -check-prefix=DEL 10; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \ 11; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=bar \ 12; RUN: | FileCheck %s -check-prefix=BAR -check-prefix=BAR-OLD 13; RUN: opt < %s 2>&1 -disable-output \ 14; RUN: -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -print-after=loop-unroll-full -filter-print-funcs=bar \ 15; RUN: | FileCheck %s -check-prefix=BAR 16; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \ 17; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=foo -print-module-scope \ 18; RUN: | FileCheck %s -check-prefix=FOO-MODULE -check-prefix=FOO-MODULE-OLD 19; RUN: opt < %s 2>&1 -disable-output \ 20; RUN: -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -print-after=loop-unroll-full -filter-print-funcs=foo -print-module-scope \ 21; RUN: | FileCheck %s -check-prefix=FOO-MODULE 22 23; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}} 24; DEL: ; Preheader: 25; DEL-NEXT: %idx = alloca i32, align 4 26; DEL: ; Loop: 27; DEL-NEXT: loop: 28; DEL: cont: 29; DEL: ; Exit blocks 30; DEL: done: 31; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}} 32; DEL: ; Preheader: 33; DEL-NEXT: br label %loop 34; DEL: ; Loop: 35; DEL-NEXT: loop: 36; DEL: ; Exit blocks 37; DEL: end: 38 39; BAR: IR Dump After {{Unroll|LoopFullUnrollPass}} 40; BAR: ; Preheader: 41; BAR-NEXT: br label %loop 42; BAR: ; Loop: 43; BAR-NEXT: loop: 44; BAR: ; Exit blocks 45; BAR: end: 46; BAR-OLD-NOT: IR Dump 47; BAR-OLD-NOT: ; Loop 48 49; FOO-MODULE: IR Dump After {{Unroll|LoopFullUnrollPass}} 50; FOO-MODULE-SAME: loop: %loop 51; FOO-MODULE-NEXT: ModuleID = 52; FOO-MODULE: define void @foo 53; FOO-MODULE: define void @bar 54; FOO-MODULE-OLD-NOT: IR Dump 55 56define void @foo(){ 57 %idx = alloca i32, align 4 58 store i32 0, i32* %idx, align 4 59 br label %loop 60 61loop: 62 %1 = load i32, i32* %idx, align 4 63 %2 = icmp slt i32 %1, 10 64 br i1 %2, label %cont, label %done 65 66cont: 67 %3 = load i32, i32* %idx, align 4 68 %4 = add nsw i32 %3, 1 69 store i32 %4, i32* %idx, align 4 70 br label %loop 71 72done: 73 ret void 74} 75 76define void @bar(){ 77 br label %loop 78loop: 79 br i1 1, label %loop, label %end 80end: 81 ret void 82} 83