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

--- Comment #3 from Jiangning Liu <jiangning.liu at amperecomputing dot com> ---
The gcc compilation difference between FOR_UP_LIMIT is 3 and 4 is that,
cunrolli can do loop unrolling when FOR_UP_LIMIT is 3, for which the control
flow can be significantly simplified, so the conditional store optimization in
phiopt will not be triggered.

The following code is generated with conditional store optimization, and
"cstore_8 = MEM <char *[2]> [(void *)&Msg][0];" is inserted in the else branch
"if (m1_9(D) != 0B)" statement.

  <bb 2> [local count: 214748364]:
  if (m1_9(D) != 0B)
    goto <bb 4>; [70.00%]
  else
    goto <bb 3>; [30.00%]

  <bb 3> [local count: 64424509]:
  cstore_8 = MEM <char *[2]> [(void *)&Msg][0];

  <bb 4> [local count: 214748364]:
  # num_2 = PHI <1(2), 0(3)>
  # cstore_4 = PHI <m1_9(D)(2), cstore_8(3)>
  MEM <char *[2]> [(void *)&Msg][0] = cstore_4;

The possible solution is to disable this optimization when
"-Werror=maybe-uninitialized" is enabled.

Reply via email to