[turbofan] fix type widening bug in RedundancyElimination

Bug: chromium:1031909
Change-Id: Ibf120d722a8cb6eb9b9eaa15163cb7846dab64ea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1981507
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65599}
This commit is contained in:
Tobias Tebbi 2020-01-02 15:13:30 +01:00 committed by Commit Bot
parent 338475d1db
commit 3f7e99ac46

View File

@ -385,7 +385,9 @@ Reduction RedundancyElimination::ReduceSpeculativeNumberOperation(Node* node) {
// than the type of the {first} node, otherwise we
// would end up replacing NumberConstant inputs with
// CheckBounds operations, which is kind of pointless.
if (!NodeProperties::GetType(first).Is(NodeProperties::GetType(check))) {
// In addition, as always, we need to make sure not to widen types.
if (!NodeProperties::GetType(first).Is(NodeProperties::GetType(check)) &&
NodeProperties::GetType(check).Is(NodeProperties::GetType(first))) {
NodeProperties::ReplaceValueInput(node, check, 0);
}
}