Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. I'm taking a liberty by committing this cleanup in stage 4, but it's confined to the analyzer and seems low-risk.
Pushed to trunk as r12-6999-gea3e1915954371. gcc/analyzer/ChangeLog: * region.cc (region::calc_offset): Consolidate effectively identical cases. Signed-off-by: David Malcolm <dmalc...@redhat.com> --- gcc/analyzer/region.cc | 48 +++++------------------------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index 9d8fdb22271..77554b86143 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -499,41 +499,16 @@ region::calc_offset () const switch (iter_region->get_kind ()) { case RK_FIELD: - { - const field_region *field_reg - = (const field_region *)iter_region; - iter_region = iter_region->get_parent_region (); - - bit_offset_t rel_bit_offset; - if (!field_reg->get_relative_concrete_offset (&rel_bit_offset)) - return region_offset::make_symbolic (iter_region); - accum_bit_offset += rel_bit_offset; - } - continue; - case RK_ELEMENT: - { - const element_region *element_reg - = (const element_region *)iter_region; - iter_region = iter_region->get_parent_region (); - - bit_offset_t rel_bit_offset; - if (!element_reg->get_relative_concrete_offset (&rel_bit_offset)) - return region_offset::make_symbolic (iter_region); - accum_bit_offset += rel_bit_offset; - } - continue; - case RK_OFFSET: + case RK_BIT_RANGE: { - const offset_region *offset_reg - = (const offset_region *)iter_region; - iter_region = iter_region->get_parent_region (); - bit_offset_t rel_bit_offset; - if (!offset_reg->get_relative_concrete_offset (&rel_bit_offset)) - return region_offset::make_symbolic (iter_region); + if (!iter_region->get_relative_concrete_offset (&rel_bit_offset)) + return region_offset::make_symbolic + (iter_region->get_parent_region ()); accum_bit_offset += rel_bit_offset; + iter_region = iter_region->get_parent_region (); } continue; @@ -549,19 +524,6 @@ region::calc_offset () const } continue; - case RK_BIT_RANGE: - { - const bit_range_region *bit_range_reg - = (const bit_range_region *)iter_region; - iter_region = iter_region->get_parent_region (); - - bit_offset_t rel_bit_offset; - if (!bit_range_reg->get_relative_concrete_offset (&rel_bit_offset)) - return region_offset::make_symbolic (iter_region); - accum_bit_offset += rel_bit_offset; - } - continue; - default: return region_offset::make_concrete (iter_region, accum_bit_offset); } -- 2.26.3