Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 074752b39954738df7e777387e089d5268f55ce2..cccc76b4358027d2cc6811d7c4859e6ed93f4274 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -1032,14 +1032,16 @@ class RepresentationSelector { |
node->op()->mnemonic(), replacement->id(), |
replacement->op()->mnemonic())); |
} |
- if (replacement->id() < count_) { |
- // Replace with a previously existing node eagerly. |
+ if (replacement->id() < count_ && |
+ GetInfo(replacement)->output == GetInfo(node)->output) { |
+ // Replace with a previously existing node eagerly only if the type is the |
+ // same. |
node->ReplaceUses(replacement); |
} else { |
// Otherwise, we are replacing a node with a representation change. |
// Such a substitution must be done after all lowering is done, because |
- // new nodes do not have {NodeInfo} entries, and that would confuse |
- // the representation change insertion for uses of it. |
+ // changing the type could confuse the representation change |
+ // insertion for uses of the node. |
replacements_.push_back(node); |
replacements_.push_back(replacement); |
} |