Added -disable-simplify-libcalls.

-disable-simplify-drtcalls was only intended to disable our
custom druntime call simplication pass for debugging purposes.

The new flag controls C runtime library calls optimizations as
performed by the LLVM pass, just as the corresponding LLVM tool
flags do.
This commit is contained in:
David Nadlinger
2012-11-06 23:53:59 +01:00
parent 03ef134aad
commit c558f9caab

View File

@@ -66,10 +66,15 @@ disableLangSpecificPasses("disable-d-passes",
cl::ZeroOrMore);
static cl::opt<bool>
disableSimplifyRuntimeCalls("disable-simplify-drtcalls",
disableSimplifyDruntimeCalls("disable-simplify-drtcalls",
cl::desc("Disable simplification of druntime calls"),
cl::ZeroOrMore);
static cl::opt<bool>
disableSimplifyLibCalls("disable-simplify-libcalls",
cl::desc("Disable simplification of well-known C runtime calls"),
cl::ZeroOrMore);
static cl::opt<bool>
disableGCToStack("disable-gc2stack",
cl::desc("Disable promotion of GC allocations to stack memory"),
@@ -173,12 +178,13 @@ static void addOptimizationPasses(PassManagerBase &mpm, FunctionPassManager &fpm
} else {
builder.Inliner = createAlwaysInlinerPass();
}
builder.DisableSimplifyLibCalls = disableSimplifyLibCalls;
builder.DisableUnitAtATime = !unitAtATime;
builder.DisableUnrollLoops = optLevel == 0;
/* builder.Vectorize is set in ctor from command line switch */
if (!disableLangSpecificPasses) {
if (!disableSimplifyRuntimeCalls)
if (!disableSimplifyDruntimeCalls)
builder.addExtension(PassManagerBuilder::EP_LoopOptimizerEnd, addSimplifyDRuntimeCallsPass);
#if USE_METADATA
@@ -213,7 +219,7 @@ bool ldc_optimize_module(llvm::Module* m)
TargetLibraryInfo *tli = new TargetLibraryInfo(Triple(m->getTargetTriple()));
// The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (disableSimplifyRuntimeCalls)
if (disableSimplifyLibCalls)
tli->disableAllFunctions();
mpm.add(tli);