From 1a483a28bb7c58349d668ad3f54ef0e9f9607cad Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 28 Feb 2019 10:22:41 -0800 Subject: Optimize normally with debug info (#1927) * optimize normally with debug info - some of it may be removed, but that's the price of higher optimization levels, and by optimizing normally in profiling and -g2 etc. builds they are more comparable to normal ones, yielding better data * copy debug locations automatically in replaceCurrent in wasm-traversal, so optimization passes at least by default will preserve debuggability --- src/passes/pass.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/passes/pass.cpp') diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 4b14186fb..58a5f2f0a 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -156,9 +156,7 @@ void PassRunner::addDefaultFunctionOptimizationPasses() { add("flatten"); add("local-cse"); } - if (!options.debugInfo) { // debug info must be preserved, do not dce it - add("dce"); - } + add("dce"); add("remove-unused-brs"); add("remove-unused-names"); add("optimize-instructions"); @@ -215,14 +213,12 @@ void PassRunner::addDefaultGlobalOptimizationPrePasses() { void PassRunner::addDefaultGlobalOptimizationPostPasses() { // inlining/dae+optimizing can remove debug annotations - if (!options.debugInfo) { - if (options.optimizeLevel >= 2 || options.shrinkLevel >= 1) { - add("dae-optimizing"); - } - // inline when working hard, and when not preserving debug info - if (options.optimizeLevel >= 2 || options.shrinkLevel >= 2) { - add("inlining-optimizing"); - } + if (options.optimizeLevel >= 2 || options.shrinkLevel >= 1) { + add("dae-optimizing"); + } + // inline when working hard, and when not preserving debug info + if (options.optimizeLevel >= 2 || options.shrinkLevel >= 2) { + add("inlining-optimizing"); } add("duplicate-function-elimination"); // optimizations show more functions as duplicate add("remove-unused-module-elements"); -- cgit v1.2.3