1; Simple checks of -exec-on-ir-change=cat functionality 2; 3; Simple functionality check. 4; RUN: opt -S -exec-on-ir-change=cat -passes=instsimplify 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-SIMPLE 5; 6; Check that only the passes that change the IR are printed and that the 7; others (including g) are filtered out. 8; RUN: opt -S -exec-on-ir-change=cat -passes=instsimplify -filter-print-funcs=f 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FUNC-FILTER 9; 10; Check that the reporting of IRs respects -print-module-scope 11; RUN: opt -S -exec-on-ir-change=cat -passes=instsimplify -print-module-scope 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-PRINT-MOD-SCOPE 12; 13; Check that the reporting of IRs respects -print-module-scope 14; RUN: opt -S -exec-on-ir-change=cat -passes=instsimplify -filter-print-funcs=f -print-module-scope 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FUNC-FILTER-MOD-SCOPE 15; 16; Check that reporting of multiple functions happens 17; RUN: opt -S -exec-on-ir-change=cat -passes=instsimplify -filter-print-funcs="f,g" 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FILTER-MULT-FUNC 18; 19; Check that the reporting of IRs respects -filter-passes 20; RUN: opt -S -exec-on-ir-change=cat -passes="instsimplify,no-op-function" -filter-passes="no-op-function" 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FILTER-PASSES 21; 22; Check that the reporting of IRs respects -filter-passes with multiple passes 23; RUN: opt -S -exec-on-ir-change=cat -passes="instsimplify,no-op-function" -filter-passes="no-op-function,instsimplify" 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FILTER-MULT-PASSES 24; 25; Check that the reporting of IRs respects both -filter-passes and -filter-print-funcs 26; RUN: opt -S -exec-on-ir-change=cat -passes="instsimplify,no-op-function" -filter-passes="no-op-function,instsimplify" -filter-print-funcs=f 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FILTER-FUNC-PASSES 27; 28; Check that the reporting of IRs respects -filter-passes, -filter-print-funcs and -print-module-scope 29; RUN: opt -S -exec-on-ir-change=cat -passes="instsimplify,no-op-function" -filter-passes="no-op-function,instsimplify" -filter-print-funcs=f -print-module-scope 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-FILTER-FUNC-PASSES-MOD-SCOPE 30; 31; Check that repeated passes that change the IR are printed and that the 32; others (including g) are filtered out. Note that the second time 33; instsimplify is run on f, it does not change the IR 34; RUN: opt -S -exec-on-ir-change=cat -passes="instsimplify,instsimplify" -filter-print-funcs=f 2>&1 -o /dev/null < %s | FileCheck %s --check-prefix=CHECK-MULT-PASSES-FILTER-FUNC 35; 36 37define i32 @g() { 38entry: 39 %a = add i32 2, 3 40 ret i32 %a 41} 42 43define i32 @f() { 44entry: 45 %a = add i32 2, 3 46 ret i32 %a 47} 48 49; CHECK-SIMPLE: ; ModuleID = {{.+}} 50; CHECK-SIMPLE: cat:{{.*}}Initial IR 51; CHECK-SIMPLE: define i32 @g() 52; CHECK-SIMPLE: cat:{{.*}}InstSimplifyPass 53; CHECK-SIMPLE: define i32 @f() 54; CHECK-SIMPLE: cat:{{.*}}InstSimplifyPass 55 56; CHECK-FUNC-FILTER: define i32 @f() 57; CHECK-FUNC-FILTER: cat:{{.*}}Initial IR 58; CHECK-FUNC-FILTER: define i32 @f() 59; CHECK-FUNC-FILTER: cat:{{.*}}InstSimplifyPass 60 61; CHECK-PRINT-MOD-SCOPE: ModuleID = {{.+}} 62; CHECK-PRINT-MOD-SCOPE: cat:{{.*}}Initial IR 63; CHECK-PRINT-MOD-SCOPE: ModuleID = {{.+}} 64; CHECK-PRINT-MOD-SCOPE: cat:{{.*}}InstSimplifyPass 65; CHECK-PRINT-MOD-SCOPE: ModuleID = {{.+}} 66; CHECK-PRINT-MOD-SCOPE: cat:{{.*}}InstSimplifyPass 67 68; CHECK-FUNC-FILTER-MOD-SCOPE: ; ModuleID = {{.+}} 69; CHECK-FUNC-FILTER-MOD-SCOPE: cat:{{.*}}Initial IR 70; CHECK-FUNC-FILTER-MOD-SCOPE: ModuleID = {{.+}} 71; CHECK-FUNC-FILTER-MOD-SCOPE: cat:{{.*}}InstSimplifyPass 72 73; CHECK-FILTER-MULT-FUNC: define i32 @g() 74; CHECK-FILTER-MULT-FUNC: cat:{{.*}}Initial IR 75; CHECK-FILTER-MULT-FUNC: define i32 @g() 76; CHECK-FILTER-MULT-FUNC: cat:{{.*}}InstSimplifyPass 77; CHECK-FILTER-MULT-FUNC: define i32 @f() 78; CHECK-FILTER-MULT-FUNC: cat:{{.*}}InstSimplifyPass 79 80; CHECK-FILTER-PASSES: define i32 @g() 81; CHECK-FILTER-PASSES: cat:{{.*}}Initial IR 82 83; CHECK-FILTER-MULT-PASSES: define i32 @g() 84; CHECK-FILTER-MULT-PASSES: cat:{{.*}}Initial IR 85; CHECK-FILTER-MULT-PASSES: define i32 @g() 86; CHECK-FILTER-MULT-PASSES: cat:{{.*}}InstSimplifyPass 87; CHECK-FILTER-MULT-PASSES: define i32 @f() 88; CHECK-FILTER-MULT-PASSES: cat:{{.*}}InstSimplifyPass 89 90; CHECK-FILTER-FUNC-PASSES: define i32 @f() 91; CHECK-FILTER-FUNC-PASSES: cat:{{.*}}Initial IR 92; CHECK-FILTER-FUNC-PASSES: define i32 @f() 93; CHECK-FILTER-FUNC-PASSES: cat:{{.*}}InstSimplifyPass 94 95; CHECK-FILTER-FUNC-PASSES-MOD-SCOPE: ; ModuleID = {{.+}} 96; CHECK-FILTER-FUNC-PASSES-MOD-SCOPE: cat:{{.*}}Initial IR 97; CHECK-FILTER-FUNC-PASSES-MOD-SCOPE: ModuleID = {{.+}} 98; CHECK-FILTER-FUNC-PASSES-MOD-SCOPE: cat:{{.*}}InstSimplifyPass 99 100; CHECK-MULT-PASSES-FILTER-FUNC: define i32 @f() 101; CHECK-MULT-PASSES-FILTER-FUNC: cat:{{.*}}Initial IR 102; CHECK-MULT-PASSES-FILTER-FUNC: define i32 @f() 103; CHECK-MULT-PASSES-FILTER-FUNC: cat:{{.*}}InstSimplifyPass 104