FunctionPassManager *FPM = getPerFunctionPasses();
- FPM->add(new TargetLibraryInfo(Triple(TheModule->getTargetTriple())));
+ TargetLibraryInfo *TLI =
+ new TargetLibraryInfo(Triple(TheModule->getTargetTriple()));
+ if (!CodeGenOpts.SimplifyLibCalls)
+ TLI->disableAllFunctions();
+ FPM->add(TLI);
// In -O0 if checking is disabled, we don't even have per-function passes.
if (CodeGenOpts.VerifyModule)
PassManager *MPM = getPerModulePasses();
- MPM->add(new TargetLibraryInfo(Triple(TheModule->getTargetTriple())));
+ TLI = new TargetLibraryInfo(Triple(TheModule->getTargetTriple()));
+ if (!CodeGenOpts.SimplifyLibCalls)
+ TLI->disableAllFunctions();
+ MPM->add(TLI);
// For now we always create per module passes.
llvm::createStandardModulePasses(MPM, OptLevel,