[llvm] r275074 - [LowerTypeTests] Don't rely on doInitialization().

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 10:00:31 PDT 2016


Author: davide
Date: Mon Jul 11 12:00:31 2016
New Revision: 275074

URL: http://llvm.org/viewvc/llvm-project?rev=275074&view=rev
Log:
[LowerTypeTests] Don't rely on doInitialization().

In preparation for porting this pass to the new PM (which has no
doInitialization()).

Differential Revision:  http://reviews.llvm.org/D22223

Modified:
    llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp

Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=275074&r1=275073&r2=275074&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Mon Jul 11 12:00:31 2016
@@ -253,8 +253,6 @@ struct LowerTypeTests : public ModulePas
   void buildBitSetsFromDisjointSet(ArrayRef<Metadata *> TypeIds,
                                    ArrayRef<GlobalObject *> Globals);
   bool lower();
-
-  bool doInitialization(Module &M) override;
   bool runOnModule(Module &M) override;
 };
 
@@ -266,27 +264,6 @@ char LowerTypeTests::ID = 0;
 
 ModulePass *llvm::createLowerTypeTestsPass() { return new LowerTypeTests; }
 
-bool LowerTypeTests::doInitialization(Module &Mod) {
-  M = &Mod;
-  const DataLayout &DL = Mod.getDataLayout();
-
-  Triple TargetTriple(M->getTargetTriple());
-  LinkerSubsectionsViaSymbols = TargetTriple.isMacOSX();
-  Arch = TargetTriple.getArch();
-  ObjectFormat = TargetTriple.getObjectFormat();
-
-  Int1Ty = Type::getInt1Ty(M->getContext());
-  Int8Ty = Type::getInt8Ty(M->getContext());
-  Int32Ty = Type::getInt32Ty(M->getContext());
-  Int32PtrTy = PointerType::getUnqual(Int32Ty);
-  Int64Ty = Type::getInt64Ty(M->getContext());
-  IntPtrTy = DL.getIntPtrType(M->getContext(), 0);
-
-  TypeTestCallSites.clear();
-
-  return false;
-}
-
 /// Build a bit set for TypeId using the object layouts in
 /// GlobalLayout.
 BitSetInfo LowerTypeTests::buildBitSet(
@@ -1012,5 +989,21 @@ bool LowerTypeTests::runOnModule(Module
   if (skipModule(M))
     return false;
 
+  this->M = &M;
+  const DataLayout &DL = M.getDataLayout();
+
+  Triple TargetTriple(M.getTargetTriple());
+  LinkerSubsectionsViaSymbols = TargetTriple.isMacOSX();
+  Arch = TargetTriple.getArch();
+  ObjectFormat = TargetTriple.getObjectFormat();
+
+  Int1Ty = Type::getInt1Ty(M.getContext());
+  Int8Ty = Type::getInt8Ty(M.getContext());
+  Int32Ty = Type::getInt32Ty(M.getContext());
+  Int32PtrTy = PointerType::getUnqual(Int32Ty);
+  Int64Ty = Type::getInt64Ty(M.getContext());
+  IntPtrTy = DL.getIntPtrType(M.getContext(), 0);
+
+  TypeTestCallSites.clear();
   return lower();
 }




More information about the llvm-commits mailing list