Files
sdk/pkg/compiler/test/codegen/data/phi_to_condition_test.dart
T
Stephen Adams 4df361c3c3 Reapply "[dart2js] Replace phi with controlling condition"
This reverts commit aec3ec0244.

- Corrected 'controlling condition' detection.
- Added test that is incorrectly compiled to infinite loop with incorrect controlling condition detection.

See https://github.com/dart-lang/sdk/issues/54115#issuecomment-1944285230 for an image of part of the CFG for `doWhileLoop` where the condition in B4 was previously mis-identified as controlling `phi(true,false)` at B12.

Issue: #54115
Change-Id: I0d2c2ff83b202071f6d7050d34de8ff25d05cb22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352443
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-02-15 01:02:39 +00:00

30 lines
632 B
Dart

// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@pragma('dart2js:never-inline')
/*member: foo1:function(a, b) {
var changed = a !== b;
if (changed)
A.log("changed");
return changed;
}*/
foo1(int a, int b) {
bool changed = false;
if (a != b) {
changed = true;
log('changed');
}
return changed;
}
@pragma('dart2js:never-inline')
/*member: log:ignore*/
void log(String s) {}
/*member: main:ignore*/
main() {
foo1(1, 2);
foo1(2, 1);
}