Index: runtime/vm/flow_graph_optimizer.cc |
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
index 09859de4d156b6aa43e87b52ab72f8862ad4423b..c8378b7923536f01bb51c5d50f74ca18c6966911 100644 |
--- a/runtime/vm/flow_graph_optimizer.cc |
+++ b/runtime/vm/flow_graph_optimizer.cc |
@@ -27,6 +27,11 @@ namespace dart { |
DEFINE_FLAG(int, getter_setter_ratio, 13, |
"Ratio of getter/setter usage used for double field unboxing heuristics"); |
+// Setting 'guess_other_cid' to true causes issue 23693 crash. |
+// TODO(srdjan): Evaluate if that optimization is wrong. |
+DEFINE_FLAG(bool, guess_other_cid, false, |
+ "Artificially create type feedback for arithmetic etc. operations" |
+ " by guessing the other unknown argument cid"); |
DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination."); |
DEFINE_FLAG(bool, dead_store_elimination, true, "Eliminate dead stores"); |
DEFINE_FLAG(int, max_polymorphic_checks, 4, |
@@ -196,7 +201,9 @@ bool FlowGraphOptimizer::TryCreateICData(InstanceCallInstr* call) { |
Token::IsBinaryOperator(op_kind)) { |
// Guess cid: if one of the inputs is a number assume that the other |
// is a number of same type. |
- if (Compiler::guess_other_cid()) { |
+ // Issue 23693. It is potentially wrong to assign types here that may |
+ // conflict with other graph analysis. |
+ if (FLAG_guess_other_cid) { |
const intptr_t cid_0 = class_ids[0]; |
const intptr_t cid_1 = class_ids[1]; |
if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) { |