This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/85116] std::min_element does not optimize well with inlined predicate


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So loop-header copying now DTRT but then PRE is faced with

  <bb 4> [local count: 955630223]:
  # __first_20 = PHI <&testArray._M_elems(2), __first_21(7)>
  # __first_21 = PHI <&MEM[(void *)&testArray + 8B](2), __first_7(7)>
  # __result_22 = PHI <&testArray._M_elems(2), __result_15(7)>
  _8 = MEM[(const double *)__first_20 + 8B];
  _10 = *__result_22;
  _11 = _8 - offset_2(D);
  _12 = ABS_EXPR <_11>;
  _13 = _10 - offset_2(D);
  _14 = ABS_EXPR <_13>;
  if (_12 < _14)
    goto <bb 5>; [50.00%]
  else
    goto <bb 8>; [50.00%]

  <bb 5> [local count: 477815111]:
  goto <bb 3>; [100.00%]

  <bb 8> [local count: 477815112]:

  <bb 3> [local count: 955630224]:
  # __result_15 = PHI <__first_21(5), __result_22(8)>
  __first_7 = __first_21 + 8;
  if (__first_7 != &MEM[(void *)&testArray + 8000B])
    goto <bb 7>; [89.00%]
  else
    goto <bb 6>; [11.00%]

  <bb 7> [local count: 850510900]:
  goto <bb 4>;

where the situation is too confusing to be recognized.  As said, loop-header
copying doing a SSA update introduces the extra IV somehow.  That needs to be
investigated.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]