https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64700
--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #17)
> There is a missing PRE/hoist here though.
>
> After PRE we have:
> ```
>
> if (dir_lsm_flag.27_61 != 0)
> goto <bb 14>; [66.67%]
> else
> goto <bb 15>; [33.33%]
>
> <bb 14> [local count: 8423325]:
> dir = dir_lsm.26_57;
>
> <bb 15> [local count: 12634988]:
> if (pos_lsm_flag.25_53 != 0)
> goto <bb 17>; [66.67%]
> else
> goto <bb 16>; [33.33%]
>
> <bb 16> [local count: 4211663]:
> pretmp_100 = dir;
> _103 = (unsigned int) pretmp_100;
> _108 = (int) _103;
> goto <bb 18>; [100.00%]
>
> <bb 17> [local count: 8423325]:
> pos = pos_lsm.24_32;
> _97 = (unsigned int) pos_lsm.24_32;
> pretmp_99 = dir;
> ```
>
> Notice how there is a load from dir on both sides of the condition of bb 16
> and 17.
> And then there is missing PRE from dir here too.
I can't reproduce the above. I see the following (original testcase, -O2):
if (dir_lsm_flag.27_61 != 0)
goto <bb 14>; [66.67%]
else
goto <bb 15>; [33.33%]
<bb 14> [local count: 8423325]:
dir = dir_lsm.26_57;
<bb 15> [local count: 12634988]:
if (pos_lsm_flag.25_53 != 0)
goto <bb 16>; [66.67%]
else
goto <bb 17>; [33.33%]
<bb 16> [local count: 8423325]:
pos = pos_lsm.24_32;
<bb 17> [local count: 14196616]:
pos.17_24 = pos;
_25 = (unsigned int) pos.17_24;
dir.18_26 = dir;
dir.19_27 = (unsigned int) dir.18_26;
_28 = _25 + dir.19_27;
_38 = (int) _28;
return _38;