Skip to content

Commit 30d6cc9

Browse files
alexmarkovCommit Queue
authored andcommitted
[vm,tests] Fix vm/dart/devirtualization_during_inlining_il_test on vm-aot-optimization-level-linux-release-x64
TEST=vm/dart/devirtualization_during_inlining_il_test Fixes #54940 Change-Id: If867cdcffbed32925ff40094fc112cd6b238ac97 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408120 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 7134a45 commit 30d6cc9

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

runtime/tests/vm/dart/devirtualization_during_inlining_il_test.dart

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import 'dart:collection';
1212

1313
import 'package:vm/testing/il_matchers.dart';
1414

15+
@pragma('vm:never-inline')
16+
void myprint(Object? obj) {
17+
print(obj);
18+
}
19+
1520
class TestIterable extends IterableBase<int> {
1621
@pragma('vm:prefer-inline')
1722
TestIterator get iterator => TestIterator(this);
@@ -41,16 +46,14 @@ class TestIterator implements Iterator<int> {
4146
return true;
4247
}
4348

44-
List<int> toList() => [
45-
for (; moveNext();) current,
46-
];
49+
List<int> toList() => [for (; moveNext();) current];
4750
}
4851

4952
@pragma('vm:never-inline')
5053
@pragma('vm:testing:print-flow-graph')
5154
void test(TestIterable obj) {
5255
for (var el in obj) {
53-
print(el);
56+
myprint(el);
5457
}
5558
}
5659

@@ -66,26 +69,25 @@ void matchIL$test(FlowGraph graph) {
6669
match.block('Join', [
6770
'index' << match.Phi(match.any, 'inc'),
6871
match.CheckStackOverflow(),
69-
match.Branch(match.RelationalOp('index', match.any, kind: '>='),
70-
ifTrue: 'LoopExit', ifFalse: 'LoopBody'),
71-
]),
72-
'LoopExit' <<
73-
match.block('Target', [
74-
match.DartReturn(),
72+
match.Branch(
73+
match.RelationalOp('index', match.any, kind: '>='),
74+
ifTrue: 'LoopExit',
75+
ifFalse: 'LoopBody',
76+
),
7577
]),
78+
'LoopExit' << match.block('Target', [match.DartReturn()]),
7679
'LoopBody' <<
7780
match.block('Target', [
7881
'inc' << match.BinaryInt64Op('index', match.any),
7982
'boxed_index' << match.BoxInt64('index'),
80-
'interpolate' << match.StaticCall('boxed_index'),
81-
match.StaticCall('interpolate'),
83+
match.StaticCall('boxed_index'),
8284
match.Goto('LoopHeader'),
8385
]),
8486
]);
8587
}
8688

8789
void main() {
88-
print(TestIterator([0, 1, 2, 3, 4]).toList());
89-
print(TestIterator(const [0, 1, 2, 3, 4]).toList());
90+
myprint(TestIterator([0, 1, 2, 3, 4]).toList());
91+
myprint(TestIterator(const [0, 1, 2, 3, 4]).toList());
9092
test(TestIterable());
9193
}

0 commit comments

Comments
 (0)