[PATCH] D66253: [NewPM][PassInstrumentation] IR printing support for (Thin)LTO

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 10:17:43 PDT 2019


twoh updated this revision to Diff 215429.
twoh added a comment.

Remove redundant lines from the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66253

Files:
  llvm/lib/LTO/LTOBackend.cpp
  llvm/test/ThinLTO/X86/printer.ll


Index: llvm/test/ThinLTO/X86/printer.ll
===================================================================
--- /dev/null
+++ llvm/test/ThinLTO/X86/printer.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-lto2 run -r=%t.bc,foo,pxl -use-new-pm --print-before-all %t.bc -o - 2>&1 | FileCheck %s --check-prefix=CHECK-BEFORE
+; RUN: llvm-lto2 run -r=%t.bc,foo,pxl -use-new-pm --print-after-all %t.bc -o - 2>&1 | FileCheck %s --check-prefix=CHECK-AFTER
+; CHECK-BEFORE: *** IR Dump Before GlobalDCEPass ***
+; CHECK-AFTER: *** IR Dump After GlobalDCEPass ***
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @foo() {
+    ret i32 42
+}
Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -28,6 +28,7 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Object/ModuleSymbolTable.h"
 #include "llvm/Passes/PassBuilder.h"
+#include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -165,7 +166,10 @@
                         PGOOptions::IRUse, PGOOptions::CSIRUse);
   }
 
-  PassBuilder PB(TM, PipelineTuningOptions(), PGOOpt);
+  PassInstrumentationCallbacks PIC;
+  StandardInstrumentations SI;
+  SI.registerCallbacks(PIC);
+  PassBuilder PB(TM, PipelineTuningOptions(),PGOOpt, &PIC);
   AAManager AA;
 
   // Parse a custom AA pipeline if asked to.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66253.215429.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/a5eaefad/attachment-0001.bin>


More information about the llvm-commits mailing list