PassManager PM;
// Add an appropriate TargetLibraryInfo pass for the module's triple.
- TargetLibraryInfo *TLI = new TargetLibraryInfo(TheTriple);
+ TargetLibraryInfo TLI(Triple(M->getTargetTriple()));
+
+ // The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (DisableSimplifyLibCalls)
- TLI->disableAllFunctions();
- PM.add(TLI);
+ TLI.disableAllFunctions();
+ PM.add(new TargetLibraryInfoWrapperPass(TLI));
// Add the target data from the target machine, if it exists, or the module.
if (const DataLayout *DL = Target->getSubtargetImpl()->getDataLayout())