[PM] Separate the TargetLibraryInfo object from the immutable pass.
[oota-llvm.git] / tools / opt / opt.cpp
index 95defb6a1a0899b17780fb89033e47398f19ec64..5995a7de2e4946a712616d74459c09c7a081166e 100644 (file)
@@ -401,12 +401,12 @@ int main(int argc, char **argv) {
   PassManager Passes;
 
   // Add an appropriate TargetLibraryInfo pass for the module's triple.
-  TargetLibraryInfo *TLI = new TargetLibraryInfo(Triple(M->getTargetTriple()));
+  TargetLibraryInfo TLI(Triple(M->getTargetTriple()));
 
   // The -disable-simplify-libcalls flag actually disables all builtin optzns.
   if (DisableSimplifyLibCalls)
-    TLI->disableAllFunctions();
-  Passes.add(TLI);
+    TLI.disableAllFunctions();
+  Passes.add(new TargetLibraryInfoWrapperPass(TLI));
 
   // Add an appropriate DataLayout instance for this module.
   const DataLayout *DL = M->getDataLayout();