https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92980

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On January 16, 2020 3:55:18 AM GMT+01:00, wwwhhhyyy333 at gmail dot com
<gcc-bugzi...@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92980
>
>--- Comment #9 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> ---
>(In reply to Hongtao.liu from comment #6)
>> New fail by removal
>
>> unix/-m32: gcc.dg/tree-ssa/copy-headers-5.c scan-tree-dump ch2 "is
>now
>> do-while loop"
>> unix/-m32: gcc.dg/tree-ssa/copy-headers-5.c scan-tree-dump-times ch2
>"  if "
>> 3
>> unix/-m32: gcc.dg/tree-ssa/copy-headers-7.c scan-tree-dump ch2 "is
>now
>> do-while loop"
>> unix/-m32: gcc.dg/tree-ssa/copy-headers-7.c scan-tree-dump-times ch2
>"Will
>> duplicate bb" 3
>> unix/-m32: gcc.dg/tree-ssa/pr81744.c scan-tree-dump-times pcom
>"Store-stores
>> chain" 2
>> unix/-m64: gcc.dg/tree-ssa/copy-headers-5.c scan-tree-dump ch2 "is
>now
>> do-while loop"
>> unix/-m64: gcc.dg/tree-ssa/copy-headers-5.c scan-tree-dump-times ch2
>"  if "
>> 3
>> unix/-m64: gcc.dg/tree-ssa/copy-headers-7.c scan-tree-dump ch2 "is
>now
>> do-while loop"
>> unix/-m64: gcc.dg/tree-ssa/copy-headers-7.c scan-tree-dump-times ch2
>"Will
>> duplicate bb" 3
>
>I looked into this and found it is because of current judgement for
>do-while
>loop:
>
>----------
> <bb 2> [local count: 114863532]:  
> goto <bb 4>; [100.00%]            
>
> <bb 3> [local count: 1014686025]: 
> i.0_1 = (unsigned int) i_11;      
> _2 = i.0_1 * 4;                   
> _3 = a_14(D) + _2;                
> _4 = *_3;                         
> _5 = i_11 + 1;                    
> _6 = (unsigned int) _5;           
> _7 = _6 * 4;                      
> _8 = a_14(D) + _7;                
> _9 = *_8;                         
> if (_4 > _9)                      
>   goto <bb 5>; [5.50%]            
> else                              
>   goto <bb 6>; [94.50%]           
>
> <bb 6> [local count: 958878294]:  
>
> <bb 4> [local count: 1073741824]: 
> # i_11 = PHI <0(2), _5(6)>        
> _10 = n_13(D) + -1;               
> if (_10 > i_11)                   
>   goto <bb 3>; [94.50%]           
> else                              
>   goto <bb 5>; [5.50%]            
>
> <bb 5> [local count: 114863532]:  
> # _12 = PHI <0(3), 1(4)>          
> return _12;                       
>
>This is regarded as a do-while loop because the it satisfies all the
>condition
>for do-while loop judgement:
>
>1) Loop latch is empty.
>2) The latch has single predecessor.
>3) The latch predecessor will exit loop.
>
>But I don't think the loop above is a do-while loop, so does the
>conditions
>need to be modified?

It has two exits which makes it difficult
Or impossible to make it truly do-while.
But it's close enough and further rotating the loop doesn't make it better.

Reply via email to