Find code snippet in simplify_stmt_for_jump_threading (): if (vr->kind () == VR_RANGE) { size_t i, j; find_case_label_range (switch_stmt, vr->min (), vr->max (), &i, &j); if (i == j) { tree label = gimple_switch_label (switch_stmt, i); tree singleton; if (CASE_HIGH (label) != NULL_TREE ? (tree_int_cst_compare (CASE_LOW (label), vr->min ()) <= 0 && tree_int_cst_compare (CASE_HIGH (label), vr->max ()) >= 0) : (vr->singleton_p (&singleton) && tree_int_cst_equal (CASE_LOW (label), singleton))) return label; if (i > j) return gimple_switch_label (switch_stmt, 0); } } The conditional "if (i > j)" should be outside of "if (i == j)"?
Jeff - you touched this code last.
I think that if (i > j) case should be at the same level as the (i == j) case. It probably got goof'd up during reindention when the code was copied from tree-vrp.c.
Author: law Date: Sun Jul 7 18:42:45 2019 New Revision: 273184 URL: https://gcc.gnu.org/viewcvs?rev=273184&root=gcc&view=rev Log: PR tree-optimization/91090 * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Fix logic error in handling of ranges to simplify switch statements. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-dom.c
Fixed on the trunk. Only causes missed optimizations, so I don't think there's a strong need to backport to the release branches.