mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user