On Fri, Nov 16, 2018 at 11:45 AM Eric Botcazou <ebotca...@adacore.com> wrote: > > Hi, > > since the expansion of switches statement into decision trees was moved from > RTL to GIMPLE, the location information of the comparison statements has been > lost, i.e. GIMPLE generates comparison statements with UNKNOWN_LOCATION and > they are expanded as-is into RTL. Now this can be problematic for coverage > analysis because the statements can inherit a wrong location in the assembly. > > Therefore the attached patch propagates the location from the switch statement > to every comparison statement generated for the decision tree. > > Tested on x86_64-suse-linux, OK for mainline and 8 branch?
OK. Thanks, Richard. > > 2018-11-16 Eric Botcazou <ebotca...@adacore.com> > > * tree-switch-conversion.h (switch_decision_tree::emit_case_nodes): > Add > location_t parameter. > (switch_decision_tree::emit_cmp_and_jump_insns): Likewise. > (switch_decision_tree::do_jump_if_equal): Likewise. > * tree-switch-conversion.c (switch_decision_tree::emit): Pass location > of switch statement to emit_case_nodes. > (switch_decision_tree::emit_cmp_and_jump_insns): Add LOC parameter and > set it on the newly built GIMPLE comparison statement. > (switch_decision_tree::do_jump_if_equal): Likewise. > (switch_decision_tree::emit_case_nodes): Add LOC parameter and pass it > into calls to do_jump_if_equal as well as recursive calls. > > -- > Eric Botcazou