[PATCH] D86657: Add new hidden option -print-crash-IR that prints out IR that caused opt pipeline to crash

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 21:26:49 PDT 2020


yrouban added inline comments.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:362
 
-  sys::AddSignalHandler(CrashedIRReporter, this);
+  sys::AddSignalHandler(crashedIRReporter, this);
 
----------------
jamieschmeiser wrote:
> yrouban wrote:
> > do we need to remove this signal handler when //this// is destructed?
> I don't think it is necessary because typically, control does not return from the signal handler and destructors are not run.
1. The life time of the //PrintCrashIRInstrumentation// instance is shorter than the scope of signal handlers. So there is a chance when //PrintCrashIRInstrumentation// is destructed then LLVM is crashed. This results in executing the handler with the deleted instance of //PrintCrashIRInstrumentation//.
2. //AddSignalHandler()// has a limited number of handlers. You should not add a new handler for every new instance of //PrintCrashIRInstrumentation//. I would suggest that only one crash reporting handler is registered and this reporter maintains a global set of live instances of //PrintCrashIRInstrumentation//.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86657/new/

https://reviews.llvm.org/D86657



More information about the llvm-commits mailing list