Add new hidden option -print-on-crash that prints out IR that caused opt pipeline...
authorJamie Schmeiser <schmeise@ca.ibm.com>
Thu, 7 Oct 2021 19:02:19 +0000 (15:02 -0400)
committerArthur Eubanks <aeubanks@google.com>
Mon, 23 May 2022 22:38:38 +0000 (15:38 -0700)
commit24239e246c78c48dabdc042e5c40f40b2a28947b
tree0f82f3e5e964e643c09dd8c9d1b77656be375235
parent21c060c497fd699581e00646af520ff556fa35f3
Add new hidden option -print-on-crash that prints out IR that caused opt pipeline to crash

A new hidden option -print-on-crash that prints the IR as it was upon entering
the last pass when there is a crash.

The IR is saved in its print form before each pass is started and a
signal handler is registered.  If the compilation crashes, the signal
handler will print the saved IR to dbgs().  This option
can be modified using -print-module-scope to get the IR for the complete
module.  Note that this option only works with the new pass manager.

Reviewed By: yrouban

Differential Revision: https://reviews.llvm.org/D86657
llvm/include/llvm/Passes/StandardInstrumentations.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Other/print-on-crash.ll [new file with mode: 0644]