1; A test that the hidden option -print-on-crash properly sets a signal handler 2; which gets called when a pass crashes. The trigger-crash-module pass asserts. 3 4; RUN: not --crash opt -print-on-crash -passes=trigger-crash-module < %s 2>&1 | FileCheck %s --check-prefix=CHECK_SIMPLE 5 6; RUN: not --crash opt -print-on-crash-path=%t -passes=trigger-crash-module < %s 7; RUN: FileCheck %s --check-prefix=CHECK_SIMPLE --input-file=%t 8 9; A test that the signal handler set by the hidden option -print-on-crash 10; is not called when no pass crashes. 11 12; RUN: opt -disable-output -print-on-crash -passes="default<O2>" < %s 2>&1 | FileCheck %s --check-prefix=CHECK_NO_CRASH --allow-empty 13 14; RUN: not --crash opt -print-on-crash -print-module-scope -passes=trigger-crash-module < %s 2>&1 | FileCheck %s --check-prefix=CHECK_MODULE 15 16; RUN: not --crash opt -print-on-crash -print-module-scope -passes=trigger-crash-module -filter-passes=trigger-crash-module < %s 2>&1 | FileCheck %s --check-prefix=CHECK_MODULE 17 18; RUN: not --crash opt -print-on-crash -print-module-scope -passes=trigger-crash-module -filter-passes=blah < %s 2>&1 | FileCheck %s --check-prefix=CHECK_FILTERED 19 20; CHECK_SIMPLE: *** Dump of IR Before Last Pass {{.*}} Started *** 21; CHECK_SIMPLE: @main 22; CHECK_SIMPLE: entry: 23; CHECK_NO_CRASH-NOT: *** Dump of IR 24; CHECK_MODULE: *** Dump of Module IR Before Last Pass {{.*}} Started *** 25; CHECK_MODULE: ; ModuleID = {{.*}} 26; CHECK_FILTERED: *** Dump of Module IR Before Last Pass {{.*}} Filtered Out *** 27 28define i32 @main() { 29entry: 30 %retval = alloca i32, align 4 31 store i32 0, ptr %retval, align 4 32 ret i32 0 33} 34