Revert "[vm/compiler] Restrict !(x>y) -> (x<=y) to integral x,y"
This reverts commit 0471d7e3a1b8e3b4d056df39310e9853c5eb8ad6.
Reason for revert: crashes are happening on the Nullable test
I will fix this in the follow-up CL that was
already pending
Original change's description:
> [vm/compiler] Restrict !(x>y) -> (x<=y) to integral x,y
>
> Rationale:
> Bug found with fuzz testing! For FP, behavior around
> NaN must be preserved.
>
> Bug: https://github.com/dart-lang/sdk/issues/34466
>
>
> Change-Id: Ia4ed831fc130e58318edb838bd46e30b93f62ff3
> Reviewed-on: https://dart-review.googlesource.com/75208
> Commit-Queue: Aart Bik <ajcbik@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,alexmarkov@google.com,sjindel@google.com,asiva@google.com,ajcbik@google.com
Change-Id: Ie2e233a612cbe00478475d086eec87ff2b3d652b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/34466
Reviewed-on: https://dart-review.googlesource.com/75383
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 2205bdd..63fc9df 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -3059,15 +3059,10 @@
Definition* BooleanNegateInstr::Canonicalize(FlowGraph* flow_graph) {
Definition* defn = value()->definition();
- // Convert !(x > y) into (x <= y) for integral x, y.
if (defn->IsComparison() && defn->HasOnlyUse(value()) &&
defn->Type()->ToCid() == kBoolCid) {
- ComparisonInstr* comp = defn->AsComparison();
- if (comp->left()->Type()->IsNullableInt() &&
- comp->right()->Type()->IsNullableInt()) {
- comp->NegateComparison();
- return defn;
- }
+ defn->AsComparison()->NegateComparison();
+ return defn;
}
return this;
}
diff --git a/tests/language_2/vm/regress_34466_test.dart b/tests/language_2/vm/regress_34466_test.dart
deleted file mode 100644
index a1714ae..0000000
--- a/tests/language_2/vm/regress_34466_test.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2018, 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.
-
-// Test NaN comparison (dartbug.com/34466).
-
-// VMOptions=--no_background_compilation --optimization_counter_threshold=10
-
-import "package:expect/expect.dart";
-
-double dvar = double.nan;
-
-doTests() {
- Expect.isFalse(dvar > dvar);
- Expect.isFalse(dvar < dvar);
- Expect.isFalse(dvar <= dvar);
- Expect.isFalse(dvar >= dvar);
- Expect.isFalse(dvar > -dvar);
- Expect.isFalse(-dvar > dvar);
- Expect.isTrue(!(dvar > dvar));
- Expect.isTrue(!(dvar < dvar));
- Expect.isTrue(!(dvar <= dvar));
- Expect.isTrue(!(dvar >= dvar));
- Expect.isTrue(!(dvar > -dvar));
- Expect.isTrue(!(-dvar > dvar));
-}
-
-void main() {
- for (int i = 0; i < 20; ++i) {
- doTests();
- }
-}