[PATCH] D65975: [NewPM][PassInstrumentation] IR printing support from clang driver

Taewook Oh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 00:12:34 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368804: [NewPM][PassInstrumentation] IR printing support from clang driver (authored by twoh, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D65975?vs=214855&id=215034#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65975

Files:
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/test/Misc/printer.c


Index: cfe/trunk/test/Misc/printer.c
===================================================================
--- cfe/trunk/test/Misc/printer.c
+++ cfe/trunk/test/Misc/printer.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-llvm -fexperimental-new-pass-manager -mllvm -print-before-all %s -o %t 2>&1 | FileCheck %s --check-prefix=CHECK-BEFORE
+// RUN: %clang_cc1 -emit-llvm -fexperimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s --check-prefix=CHECK-AFTER
+// CHECK-BEFORE: *** IR Dump Before AlwaysInlinerPass ***
+// CHECK-AFTER: *** IR Dump After AlwaysInlinerPass ***
+void foo() {}
Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -37,6 +37,7 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Passes/PassBuilder.h"
 #include "llvm/Passes/PassPlugin.h"
+#include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -1063,7 +1064,10 @@
   PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
   PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
 
-  PassBuilder PB(TM.get(), PTO, PGOOpt);
+  PassInstrumentationCallbacks PIC;
+  StandardInstrumentations SI;
+  SI.registerCallbacks(PIC);
+  PassBuilder PB(TM.get(), PTO, PGOOpt, &PIC);
 
   // Attempt to load pass plugins and register their callbacks with PB.
   for (auto &PluginFN : CodeGenOpts.PassPlugins) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65975.215034.patch
Type: text/x-patch
Size: 1553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190814/cdd1a599/attachment-0001.bin>


More information about the cfe-commits mailing list