Commit 21541676 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[compiler] Re-add NaN-folding optimization

This was previously removed in
https://chromium-review.googlesource.com/c/v8/v8/+/946129.

Given that test/mjsunit/compiler/regress-817225.js no longer
reproduces, and that the original CL removed only one occurrence of
this common pattern, it's not clear that it fixes anything.

Bug: v8:7519
Change-Id: I973a581e1e6cdea5ba2ff31364bd6701602fc8d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2637854
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72212}
parent 3375b40d
......@@ -508,6 +508,12 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
}
case IrOpcode::kFloat64Add: {
Float64BinopMatcher m(node);
if (m.right().IsNaN()) { // x + NaN => NaN
return ReplaceFloat64(SilenceNaN(m.right().ResolvedValue()));
}
if (m.left().IsNaN()) { // NaN + x => NaN
return ReplaceFloat64(SilenceNaN(m.left().ResolvedValue()));
}
if (m.IsFoldable()) { // K + K => K (K stands for arbitrary constants)
return ReplaceFloat64(m.left().ResolvedValue() +
m.right().ResolvedValue());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment