[Bug tree-optimization/92980] [miss optimization]redundant load missed by fre.

wwwhhhyyy333 at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 17 06:44:00 GMT 2020


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

--- Comment #11 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> ---
(In reply to rguenther@suse.de from comment #10)
> 
> 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.

Thanks for the explanation. But the original loop without eliminating the
parser code is:

 <bb 2> [local count: 114863532]:
 goto <bb 5>; [100.00%]

 <bb 3> [local count: 1014686025]:
 i.0_1 = (unsigned int) i_10;
 _2 = i.0_1 * 4;
 _3 = a_13(D) + _2;
 _4 = *_3;
 _5 = i.0_1 + 1;
 _6 = _5 * 4;
 _7 = a_13(D) + _6;
 _8 = *_7;
 if (_4 > _8)
   goto <bb 6>; [5.50%]
 else
   goto <bb 4>; [94.50%]

 <bb 4> [local count: 958878293]:
 i_15 = i_10 + 1;

 <bb 5> [local count: 1073741824]:
 # i_10 = PHI <0(2), i_15(4)>
 _9 = n_12(D) + -1;
 if (_9 > i_10)
   goto <bb 3>; [94.50%]
 else
   goto <bb 6>; [5.50%]

 <bb 6> [local count: 114863532]:
 # _11 = PHI <0(3), 1(5)>
 return _11;

This is considered as not a do-while loop since the latch (bb 4) is not empty,
and it is successfully rotated. I don't think there is much difference except
i_15 = i_10 + 1 which can be optimized by fre after the parser change. 

So I wonder if the original one is rotated, why the one with empty latch can't.


More information about the Gcc-bugs mailing list