[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
Tue Sep 1 21:24:56 PDT 2020


yrouban added inline comments.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:205-207
+std::mutex mtx;
+// All of the crash reporters that will report on a crash.
+std::vector<PrintCrashIRInstrumentation *> CrashReporters;
----------------
please make these both static private fields of //PrintIRInstrumentation//.
rename //mtx// with first uppercase.


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:389
+  Index = CrashReporters.size();
+  CrashReporters.emplace_back(this);
+  mtx.unlock();
----------------
This way //CrashReporters// vector is growing unlimited - memory leak.
Please use a pointer set and no registration index will be needed.
E.g. DenseSet<PrintCrashIRInstrumentation *> CrashReporters;


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

https://reviews.llvm.org/D86657



More information about the llvm-commits mailing list