Skip to content

Commit eb9480d

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
Revert "[vm,aot] Simple unreachable code elimination before type-flow analysis, take 2"
This reverts commit 56991ad. Reason for revert: broke building Flutter apps in release mode Original change's description: > [vm,aot] Simple unreachable code elimination before type-flow analysis, take 2 > > This is the relanding of https://dart-review.googlesource.com/c/sdk/+/121500 > with fixes. > > Original CL description: > > This change adds transformation for very early cleanup of unreachable > code such as code guarded by if statements with constant conditions or > code used in assert statements when assertions are disabled. > > The advantage of cleaning such code early is that type-flow analysis > won't be looking at it and TFA-based tree shaker is able to remove > more code. > > flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64) > build_bench_total_size -2.533% (arm), -2.449% (arm64) > gesture_detector_total_size -4.183% (arm), -4.072% (arm64) > > Change-Id: Ief8ebd0cd828c0e7a847a824f44d2d97a3595b87 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121901 > Reviewed-by: Ryan Macnak <rmacnak@google.com> > Reviewed-by: Martin Kustermann <kustermann@google.com> > Commit-Queue: Alexander Markov <alexmarkov@google.com> TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com Change-Id: I25fe5d4457bfcc5ee25506810aa7eee01ca1b28a No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122023 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
1 parent 49d743f commit eb9480d

File tree

7 files changed

+2
-441
lines changed

7 files changed

+2
-441
lines changed

pkg/frontend_server/lib/frontend_server.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ class FrontendCompiler implements CompilerInterface {
441441
aot: options['aot'],
442442
useGlobalTypeFlowAnalysis: options['tfa'],
443443
environmentDefines: environmentDefines,
444-
enableAsserts: options['enable-asserts'],
445444
useProtobufTreeShaker: options['protobuf-tree-shaker']));
446445
}
447446
if (results.component != null) {

pkg/vm/lib/kernel_front_end.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ import 'transformations/type_flow/transformer.dart' as globalTypeFlow
5959
import 'transformations/obfuscation_prohibitions_annotator.dart'
6060
as obfuscationProhibitions;
6161
import 'transformations/call_site_annotator.dart' as call_site_annotator;
62-
import 'transformations/unreachable_code_elimination.dart'
63-
as unreachable_code_elimination;
6462

6563
/// Declare options consumed by [runCompiler].
6664
void declareCompilerOptions(ArgParser args) {
@@ -219,7 +217,6 @@ Future<int> runCompiler(ArgResults options, String usage) async {
219217
aot: aot,
220218
useGlobalTypeFlowAnalysis: tfa,
221219
environmentDefines: environmentDefines,
222-
enableAsserts: enableAsserts,
223220
genBytecode: genBytecode,
224221
bytecodeOptions: bytecodeOptions,
225222
dropAST: dropAST && !splitOutputByPackages,
@@ -288,7 +285,6 @@ Future<KernelCompilationResults> compileToKernel(
288285
{bool aot: false,
289286
bool useGlobalTypeFlowAnalysis: false,
290287
Map<String, String> environmentDefines,
291-
bool enableAsserts: true,
292288
bool genBytecode: false,
293289
BytecodeOptions bytecodeOptions,
294290
bool dropAST: false,
@@ -312,7 +308,6 @@ Future<KernelCompilationResults> compileToKernel(
312308
component,
313309
useGlobalTypeFlowAnalysis,
314310
environmentDefines,
315-
enableAsserts,
316311
useProtobufTreeShaker,
317312
errorDetector);
318313
}
@@ -367,7 +362,6 @@ Future _runGlobalTransformations(
367362
Component component,
368363
bool useGlobalTypeFlowAnalysis,
369364
Map<String, String> environmentDefines,
370-
bool enableAsserts,
371365
bool useProtobufTreeShaker,
372366
ErrorDetector errorDetector) async {
373367
if (errorDetector.hasCompilationErrors) return;
@@ -382,10 +376,6 @@ Future _runGlobalTransformations(
382376
// when building a platform dill file for VM/JIT case.
383377
mixin_deduplication.transformComponent(component);
384378

385-
// Unreachable code elimination transformation should be performed
386-
// before type flow analysis so TFA won't take unreachable code into account.
387-
unreachable_code_elimination.transformComponent(component, enableAsserts);
388-
389379
if (useGlobalTypeFlowAnalysis) {
390380
globalTypeFlow.transformComponent(
391381
compilerOptions.target, coreTypes, component);

pkg/vm/lib/transformations/unreachable_code_elimination.dart

Lines changed: 0 additions & 171 deletions
This file was deleted.

pkg/vm/test/common_test_utils.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ class TestingVmTarget extends VmTarget {
3333
}
3434

3535
Future<Component> compileTestCaseToKernelProgram(Uri sourceUri,
36-
{Target target,
37-
bool enableSuperMixins = false,
38-
Map<String, String> environmentDefines}) async {
36+
{Target target, bool enableSuperMixins: false}) async {
3937
final platformKernel =
4038
computePlatformBinariesLocation().resolve('vm_platform_strong.dill');
4139
target ??= new TestingVmTarget(new TargetFlags())
4240
..enableSuperMixins = enableSuperMixins;
43-
environmentDefines ??= <String, String>{};
4441
final options = new CompilerOptions()
4542
..target = target
4643
..linkedDependencies = <Uri>[platformKernel]
47-
..environmentDefines = environmentDefines
44+
..environmentDefines = <String, String>{}
4845
..onDiagnostic = (DiagnosticMessage message) {
4946
fail("Compilation error: ${message.plainTextFormatted.join('\n')}");
5047
};

pkg/vm/test/transformations/unreachable_code_elimination_test.dart

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)