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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 2 Nov 2021, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103037
> 
> --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> We have:
>   var_3.2_4 = var_3;
>   iftmp.1_14 = (int) var_3.2_4;
>   var_11_lsm.14_8 = _7(D);
> 
>   <bb 3> [local count: 955630225]:
>   # RANGE [0, 24] NONZERO 31
>   # a_20 = PHI <a_18(10), 0(9)>
>   _19 = MEM <short unsigned int[23]> [(short unsigned int &)&arr_4][a_20];
>   if (_19 > 1)
>     goto <bb 5>; [50.00%]
>   else
>     goto <bb 4>; [50.00%]
> 
>   <bb 4> [local count: 477815112]:
>   # RANGE [0, 1] NONZERO 1
>   _3 = (int) _19;
>   if (_19 != 0)
>     goto <bb 5>; [20.00%]
>   else
>     goto <bb 6>; [80.00%]
> 
>   <bb 5> [local count: 477815112]:
>   # RANGE [0, 1] NONZERO 1
>   # _24 = PHI <_3(4), 1(3)>
>   # RANGE [1, 65535] NONZERO 65535
>   iftmp.1_15 = (int) _19;
>   goto <bb 7>; [100.00%]
> 
>   <bb 6> [local count: 477815112]:
> 
>   <bb 7> [local count: 955630225]:
>   # RANGE [-32768, 65535]
>   # iftmp.1_10 = PHI <iftmp.1_15(5), iftmp.1_14(6)>
>   # RANGE [0, 1] NONZERO 1
>   # _25 = PHI <_24(5), 0(6)>
>   # RANGE [-1, 1]
>   _5 = _25 / iftmp.1_10;
> and seems PRE is trying top simplify 1 / _3 and _3 / _3.  _3 has correctly
> range of [0, 1] - in that bb _19 can't be anything but 0 or 1 given the
> condition, but
> iftmp.1_15 = (int) _19; isn't equivalent to that, because it is reachable from
> other bbs, even when it is also (int) _19.
> So, does PRE need to temporarily reset_flow_sensitive_info in such cases and
> restore if it didn't succeed?

No, we have means to avoid this situation but somehow it doesn't work.
Give me some time to look into this.

Reply via email to