[llvm] r272721 - [PM] Port WholeProgramDevirt to the new pass manager.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 14:44:20 PDT 2016


Author: davide
Date: Tue Jun 14 16:44:19 2016
New Revision: 272721

URL: http://llvm.org/viewvc/llvm-project?rev=272721&view=rev
Log:
[PM] Port WholeProgramDevirt to the new pass manager.

Modified:
    llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h
    llvm/trunk/lib/Passes/PassBuilder.cpp
    llvm/trunk/lib/Passes/PassRegistry.def
    llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
    llvm/trunk/test/Transforms/WholeProgramDevirt/constant-arg.ll

Modified: llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h?rev=272721&r1=272720&r2=272721&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h Tue Jun 14 16:44:19 2016
@@ -15,6 +15,8 @@
 #ifndef LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H
 #define LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H
 
+#include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
 #include <cassert>
 #include <cstdint>
 #include <utility>
@@ -210,6 +212,11 @@ void setAfterReturnValues(MutableArrayRe
                           int64_t &OffsetByte, uint64_t &OffsetBit);
 
 } // end namespace wholeprogramdevirt
+
+struct WholeProgramDevirtPass : public PassInfoMixin<WholeProgramDevirtPass> {
+  PreservedAnalyses run(Module &M);
+};
+
 } // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_IPO_WHOLEPROGRAMDEVIRT_H

Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=272721&r1=272720&r2=272721&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Tue Jun 14 16:44:19 2016
@@ -63,6 +63,7 @@
 #include "llvm/Transforms/IPO/Internalize.h"
 #include "llvm/Transforms/IPO/SCCP.h"
 #include "llvm/Transforms/IPO/StripDeadPrototypes.h"
+#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
 #include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/InstrProfiling.h"
 #include "llvm/Transforms/PGOInstrumentation.h"

Modified: llvm/trunk/lib/Passes/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=272721&r1=272720&r2=272721&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassRegistry.def (original)
+++ llvm/trunk/lib/Passes/PassRegistry.def Tue Jun 14 16:44:19 2016
@@ -60,6 +60,7 @@ MODULE_PASS("print-lcg", LazyCallGraphPr
 MODULE_PASS("rpo-functionattrs", ReversePostOrderFunctionAttrsPass())
 MODULE_PASS("sample-profile", SampleProfileLoaderPass())
 MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
+MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass())
 MODULE_PASS("verify", VerifierPass())
 #undef MODULE_PASS
 

Modified: llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=272721&r1=272720&r2=272721&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp Tue Jun 14 16:44:19 2016
@@ -280,6 +280,12 @@ ModulePass *llvm::createWholeProgramDevi
   return new WholeProgramDevirt;
 }
 
+PreservedAnalyses WholeProgramDevirtPass::run(Module &M) {
+  if (!DevirtModule(M).run())
+    return PreservedAnalyses::all();
+  return PreservedAnalyses::none();
+}
+
 void DevirtModule::buildBitSets(
     std::vector<VTableBits> &Bits,
     DenseMap<Metadata *, std::set<BitSetInfo>> &BitSets) {

Modified: llvm/trunk/test/Transforms/WholeProgramDevirt/constant-arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/WholeProgramDevirt/constant-arg.ll?rev=272721&r1=272720&r2=272721&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/WholeProgramDevirt/constant-arg.ll (original)
+++ llvm/trunk/test/Transforms/WholeProgramDevirt/constant-arg.ll Tue Jun 14 16:44:19 2016
@@ -1,4 +1,5 @@
 ; RUN: opt -S -wholeprogramdevirt %s | FileCheck %s
+; RUN: opt -S -passes=wholeprogramdevirt %s | FileCheck %s
 
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"




More information about the llvm-commits mailing list