Index: runtime/vm/intermediate_language.cc |
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
index 7b8e997150c84ea4da8d6cf68d74312d98a54121..48edba328def479ce21179cdd7aacdf382e20986 100644 |
--- a/runtime/vm/intermediate_language.cc |
+++ b/runtime/vm/intermediate_language.cc |
@@ -1821,7 +1821,16 @@ Instruction* BranchInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
Definition* replacement = comparison()->Canonicalize(optimizer); |
if (replacement == comparison() || replacement == NULL) return this; |
ComparisonInstr* comp = replacement->AsComparison(); |
- if (comp == NULL) return this; |
+ if ((comp == NULL) || comp->CanDeoptimize()) return this; |
+ |
+ // Check that comparison is not serving as a pending deoptimization target |
+ // for conversions. |
+ for (intptr_t i = 0; i < comp->InputCount(); i++) { |
+ if (comp->RequiredInputRepresentation(i) != |
+ comp->InputAt(i)->definition()->representation()) { |
+ return this; |
+ } |
+ } |
// Replace the comparison if the replacement is used at this branch, |
// and has exactly one use. |