diff --git a/gen/optimizer.cpp b/gen/optimizer.cpp index 76b53569..b0eef1d7 100644 --- a/gen/optimizer.cpp +++ b/gen/optimizer.cpp @@ -80,10 +80,12 @@ disableSimplifyDruntimeCalls("disable-simplify-drtcalls", cl::desc("Disable simplification of druntime calls"), cl::ZeroOrMore); +#if LDC_LLVM_VER < 304 static cl::opt disableSimplifyLibCalls("disable-simplify-libcalls", cl::desc("Disable simplification of well-known C runtime calls"), cl::ZeroOrMore); +#endif static cl::opt disableGCToStack("disable-gc2stack", @@ -179,7 +181,9 @@ static void addOptimizationPasses(PassManagerBase &mpm, FunctionPassManager &fpm } else { builder.Inliner = createAlwaysInlinerPass(); } +#if LDC_LLVM_VER < 304 builder.DisableSimplifyLibCalls = disableSimplifyLibCalls; +#endif builder.DisableUnitAtATime = !unitAtATime; builder.DisableUnrollLoops = optLevel == 0; /* builder.Vectorize is set in ctor from command line switch */ @@ -211,9 +215,11 @@ bool ldc_optimize_module(llvm::Module* m) // Add an appropriate TargetLibraryInfo pass for the module's triple. TargetLibraryInfo *tli = new TargetLibraryInfo(Triple(m->getTargetTriple())); +#if LDC_LLVM_VER < 304 // The -disable-simplify-libcalls flag actually disables all builtin optzns. if (disableSimplifyLibCalls) tli->disableAllFunctions(); +#endif mpm.add(tli); // Add an appropriate TargetData instance for this module.