https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95757
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org,
| |jakub at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We get only 3 warnings on the last function with
-O2 -Wall -Wno-array-bounds --param=logical-op-non-short-circuit=0
-ftrack-macro-expansion=0
while we get 4 with
-O2 -Wall -Wno-array-bounds --param=logical-op-non-short-circuit=1
-ftrack-macro-expansion=0
I think the important differences are that while we have in *.optimized pretty
much the same IL - I only see differences between SSA_NAME versions, in the
--param=logical-op-non-short-circuit=1 case we have more accurate
SSA_NAME_RANGE_INFO on 3 SSA_NAMEs
<bb 2> [local count: 1073741824]:
- _51 ={v} unsigned_value_source;
- if (_51 > 1)
+ _57 ={v} unsigned_value_source;
+ if (_57 > 1)
goto <bb 4>; [50.00%]
else
goto <bb 3>; [50.00%]
<bb 3> [local count: 536870912]:
# RANGE [1, 2] NONZERO 3
- _55 = _51 + 1;
+ _55 = _57 + 1;
<bb 4> [local count: 1073741824]:
# RANGE [1, 2] NONZERO 3
- # prephitmp_54 = PHI <_55(3), 1(2)>
- _49 ={v} unsigned_value_source;
- _48 = _49 + 18446744073709551615;
- if (_48 > 1)
+ # prephitmp_50 = PHI <1(2), _55(3)>
+ _52 ={v} unsigned_value_source;
+ _59 = _52 + 18446744073709551615;
+ if (_59 > 1)
goto <bb 6>; [50.00%]
else
goto <bb 5>; [50.00%]
- <bb 5> [local count: 268435457]:
- _53 = _49 + 1;
+ <bb 5> [local count: 536870913]:
+ # RANGE [2, 3] NONZERO 3
+ _53 = _52 + 1;
<bb 6> [local count: 1073741824]:
- # prephitmp_57 = PHI <2(4), _53(5)>
+ # RANGE [2, 3] NONZERO 3
+ # prephitmp_54 = PHI <2(4), _53(5)>
_47 ={v} unsigned_value_source;
- _52 = _47 + 18446744073709551614;
- if (_52 > 1)
+ _61 = _47 + 18446744073709551614;
+ if (_61 > 1)
goto <bb 8>; [50.00%]
else
goto <bb 7>; [50.00%]
- <bb 7> [local count: 268435457]:
- _59 = _47 + 1;
+ <bb 7> [local count: 536870913]:
+ # RANGE [3, 4] NONZERO 7
+ _48 = _47 + 1;
<bb 8> [local count: 1073741824]:
...
I mean the _53, prephitmp_54 and _48 ranges above in the + lines (i.e. =1).
Early during optimizations we have the usual short-circuit vs.
non-short-circuit differences like:
- # iftmp.0_52 = PHI <_51(3), 0(2)>
- _49 ={v} unsigned_value_source;
- if (_49 == 0)
- goto <bb 7>; [50.00%]
+ # iftmp.0_58 = PHI <0(2), _57(3)>
+ _52 ={v} unsigned_value_source;
+ _53 = _52 == 0;
+ _54 = _52 > 2;
+ _55 = _53 | _54;
+ if (_55 != 0)
+ goto <bb 6>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 5> [local count: 536870913]:
- if (_49 > 2)
- goto <bb 7>; [50.00%]
- else
- goto <bb 6>; [50.00%]
-
- <bb 6> [local count: 268435456]:
- <bb 7> [local count: 1073741824]:
- # iftmp.0_50 = PHI <1(4), 1(5), _49(6)>
+ <bb 6> [local count: 1073741824]:
+ # iftmp.0_56 = PHI <1(4), _52(5)>
but they gradually disappear.
Right before *.dom3 the IL is already pretty much the same when ignoring
SSA_NAME version differences,
except:
- # prephitmp_54 = PHI <_55(3), 1(2)>
- _49 ={v} unsigned_value_source;
- _48 = _49 + 18446744073709551615;
- _1 = _48 > 1;
- if (_1 != 0)
+ # prephitmp_50 = PHI <1(2), _55(3)>
+ _52 ={v} unsigned_value_source;
+ _59 = _52 + 18446744073709551615;
+ if (_59 > 1)
and
_47 ={v} unsigned_value_source;
- _52 = _47 + 18446744073709551614;
- _50 = _52 > 1;
- if (_50 != 0)
+ _61 = _47 + 18446744073709551614;
+ if (_61 > 1)
i.e. the - version (=0) doesn't have the comparisons folded into GIMPLE_CONDs
while the + version (=1) does.
And I believe that is the trigger on why during dom3 adds the more precise
ranges in the --param=logical-op-non-short-circuit=1 case and not in the
--param=logical-op-non-short-circuit=0 case.