[PATCH] Fix cfgcleanup regression (PR rtl-optimization/59724)

Jeff Law law@redhat.com
Thu Jan 9 04:19:00 GMT 2014


On 01/08/14 15:42, Jakub Jelinek wrote:
> On Wed, Jan 08, 2014 at 05:54:55PM +0100, Uros Bizjak wrote:
>> This caused PR59724 on alpha:
>>
>> 20021116-1.c: In function ‘foo’:
>> 20021116-1.c:31:1: error: NOTE_INSN_BASIC_BLOCK is missing for block 9
>>   }
>>   ^
>> 20021116-1.c:31:1: error: insn outside basic block
>> (jump_insn 94 52 93 9 (return) 20021116-1.c:31 -1
>>       (nil)
>>   -> return)
>
> Ugh, indeed.  The problem is that try_head_merge_bb really wants
> flow_find_head_matching_sequence to count all (non-note) insns, not
> just active insns, because otherwise as in the above testcase we
> can have e.g. 2 active insns followed by one non-active, all matching
> (flow_find_head_matching_sequence returns 2) and on another edge
> just 2 active insns and nothing else matching.  2 == 2, so the caller
> thinks it doesn't matter which one is shorter, but we have the insn range
> of 3 insns together.
>
> So, this patch just reverts the try_head_merge_bb changes and makes
> flow_find_head_matching_sequence behave the old way when called from
> try_head_merge_bb, i.e. count all non-note insns, and only when called
> from ifcvt.c count just active insns.  Plus the ifcvt.c change ensures
> we don't mistakenly call it with stop_after == 0 (which wouldn't actually
> stop).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, Uros is testing it
> on Alpha.  Ok for trunk?
>
> 2014-01-08  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR rtl-optimization/59724
> 	* ifcvt.c (cond_exec_process_if_block): Don't call
> 	flow_find_head_matching_sequence with 0 longest_match.
> 	* cfgcleanup.c (flow_find_head_matching_sequence): Count even
> 	non-active insns if !stop_after.
> 	(try_head_merge_bb): Revert 2014-01-07 changes.
OK.

Jeff



More information about the Gcc-patches mailing list