tree
hybrid_folder::choose_value (tree evrp_val, tree ranger_val)
{
- if (!ranger_val)
- {
- // If neither returned a value, return NULL_TREE.
- if (!evrp_val)
- return NULL_TREE;
+ // If both found the same value, just return it.
+ if (evrp_val && ranger_val && !compare_values (evrp_val, ranger_val))
+ return evrp_val;
+
+ // If neither returned a value, return NULL_TREE.
+ if (!ranger_val && !evrp_val)
+ return NULL_TREE;
- // Otherwise EVRP found something.
- if (dump_file)
+ // Otherwise there is a discrepancy to flag.
+ if (dump_file)
+ {
+ if (evrp_val && ranger_val)
+ fprintf (dump_file, "EVRP:hybrid: Disagreement\n");
+ if (evrp_val)
{
fprintf (dump_file, "EVRP:hybrid: EVRP found singleton ");
print_generic_expr (dump_file, evrp_val);
fprintf (dump_file, "\n");
}
- return evrp_val;
+ if (ranger_val)
+ {
+ fprintf (dump_file, "EVRP:hybrid: RVRP found singleton ");
+ print_generic_expr (dump_file, ranger_val);
+ fprintf (dump_file, "\n");
+ }
}
- // Otherwise ranger found a value, if they match we're good.
- if (evrp_val && !compare_values (evrp_val, ranger_val))
+ // If one value was found, return it.
+ if (!evrp_val)
+ return ranger_val;
+ if (!ranger_val)
return evrp_val;
- // We should never get different singletons.
- gcc_checking_assert (!evrp_val);
-
- // Now ranger has found a value, but EVRP did not.
- if (dump_file)
- {
- fprintf (dump_file, "EVRP:hybrid: RVRP found singleton ");
- print_generic_expr (dump_file, ranger_val);
- fprintf (dump_file, "\n");
- }
- return ranger_val;
+ // If values are different, return the first calculated value.
+ if ((param_evrp_mode & EVRP_MODE_RVRP_FIRST) == EVRP_MODE_RVRP_FIRST)
+ return ranger_val;
+ return evrp_val;
}
/* Main entry point for the early vrp pass which is a simplified non-iterative
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct tree_node *tree;
+enum tree_code { RECORD_TYPE, QUAL_UNION_TYPE };
+enum tree_code_class {};
+struct tree_base {
+ tree_code code : 16;
+};
+struct tree_node {
+ tree_base base;
+};
+extern tree_code_class tree_code_type[];
+void tree_check_failed() __attribute__((__noreturn__));
+tree tree_check3(tree __t, tree_code __c1, tree_code __c3) {
+ if (__t->base.code != __c1 && __t->base.code != __c3)
+ tree_check_failed();
+ return __t;
+}
+tree add_type_duplicate_type;
+void add_type_duplicate() {
+ if (tree_code_type[add_type_duplicate_type->base.code])
+ if (add_type_duplicate_type->base.code == RECORD_TYPE)
+ for (;
+ tree_check3(add_type_duplicate_type, RECORD_TYPE, QUAL_UNION_TYPE);)
+ tree_check3(add_type_duplicate_type, RECORD_TYPE, QUAL_UNION_TYPE);
+}