[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
Wed Sep 2 23:13:33 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;
----------------
aeubanks wrote:
> yrouban wrote:
> > please make these both static private fields of //PrintIRInstrumentation//.
> > rename //mtx// with first uppercase.
> https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors
Please elaborate. Do you mean you disagree agree with my suggestion?
I just proposed to hide the //mtx// and //CrashReporters// making them static fields of //PrintCrashIRInstrumentation//:

StandardInstrumentations.h:
  class PrintCrashIRInstrumentation {
    ...
    // Avoid races when creating/destroying the crash IR printers.
    static std::mutex mtx;
    // All of the crash reporters that will report on a crash.
    static std::vector<PrintCrashIRInstrumentation *> CrashReporters;
  }

StandardInstrumentations.cpp:
  std::mutex PrintCrashIRInstrumentation::mtx;
  std::vector<PrintCrashIRInstrumentation *> PrintCrashIRInstrumentation::CrashReporters;

This is essentially the same as
  std::mutex mtx;
  std::vector<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