On Sat, Jul 21, 2012 at 3:57 PM, Tom de Vries <tom_devr...@mentor.com> wrote: > Jakub, > > this patch adds propagation of anti-ranges to switches. > > The test-case is this: > ... > void > f3 (int s) > { > if (s >> 3 == -2) > /* s in range [ -16, -9]. */ > ; > else > { > /* s in range ~[-16, -9], so none of the case labels can be taken. */ > switch (s) > { > case -16: > case -12: > case -9: > link_error (); > break; > default: > break; > } > } > } > ... > > The call to link_error is unreachable but tree-vrp fails to analyze that. > > Using the patch, the switch is replaced by the default case. > > Bootstrapped and reg-tested (Ada inclusive) on x86_64. > > OK for trunk?
Ok. Thanks, Richard. > Thanks, > - Tom > > 2012-07-21 Tom de Vries <t...@codesourcery.com> > > * tree-vrp.c (find_case_label_ranges): New function. > (vrp_visit_switch_stmt, simplify_switch_using_ranges): Use > find_case_label_ranges instead of find_case_label_range. Handle > second > range. > > * gcc.dg/tree-ssa/vrp72.c: New test.