Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -329,7 +329,8 @@ // Figure out TargetLibraryInfo. Triple TargetTriple(TheModule->getTargetTriple()); - PMBuilder.LibraryInfo = createTLII(TargetTriple, CodeGenOpts); + std::unique_ptr TLII( + createTLII(TargetTriple, CodeGenOpts)); switch (Inlining) { case CodeGenOptions::NoInlining: @@ -364,6 +365,7 @@ PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; legacy::PassManager *MPM = getPerModulePasses(); + MPM->add(new TargetLibraryInfoWrapperPass(*TLII)); // If we are performing a ThinLTO importing compile, invoke the LTO // pipeline and pass down the in-memory module summary index. @@ -454,6 +456,7 @@ // Set up the per-function pass manager. legacy::FunctionPassManager *FPM = getPerFunctionPasses(); + FPM->add(new TargetLibraryInfoWrapperPass(*TLII)); if (CodeGenOpts.VerifyModule) FPM->add(createVerifierPass());