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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Under debugger (trunk) what I see is that the block_result.intersect
(equiv_range)
in the code added by r13-1938 is only true in the VisitObjCMessageExpr function
twice, each time on the
  # Result$16_552 = PHI <Result$16_670(144), Result$16_453(D)(138)>
SSA_NAME, on the
<bb 120> [local count: 251634481]:
if (p_count_732 == 1)
  goto <bb 124>; [5.50%]
else
  goto <bb 121>; [94.50%]
block (i.e. one guarded with _143 == 22 condition),
which has originally VARYING block_result, but equiv_name is strangely
_143 set by
  _143 = I.Kind;
earlier.  Obviously the range for _143 in that bb is [22, 22], that is correct,
what isn't correct is that it would be equivalent to Result$16_552.
The IL of the loop is:

  <bb 139> [local count: 740101405]:
  _143 = I.Kind;
  if (_143 == 21)
    goto <bb 140>; [34.00%]
  else
    goto <bb 141>; [66.00%]

  <bb 140> [local count: 251634481]:
  # RANGE [irange] int [-2147483647, +INF]
  p_count_87 = p_count_732 + 1;
  goto <bb 144>; [100.00%]

  <bb 141> [local count: 488466924]:
  if (_143 == 22)
    goto <bb 142>; [70.13%]
  else
    goto <bb 144>; [29.87%]

  <bb 142> [local count: 251634481]:
  if (p_count_732 == 1)
    goto <bb 147>; [5.50%]
  else
    goto <bb 143>; [94.50%]

  <bb 143> [local count: 237794584]:
  # RANGE [irange] int [-INF, -1][1, 2147483646]
  p_count_88 = p_count_732 + -1;

  <bb 144> [local count: 726261510]:
  # p_count_45 = PHI <p_count_732(141), p_count_88(143), p_count_87(140)>
  MEM <unsigned char[20]> [(struct Token *)&Result] = MEM <unsigned char[20]>
[(struct Token *)&I];
  Result$UintData_449 = MEM <const UIntTy> [(struct Token *)&I + 4B];
  Result$PtrData_172 = MEM <void * const> [(struct Token *)&I + 8B];
  Result$16_670 = MEM <unsigned short> [(struct Token *)&I + 16B];
  _439 = TheLexer.D.700857.LexingRawMode;
  if (_439 != 0)
    goto <bb 146>; [99.96%]
  else
    goto <bb 145>; [0.04%]

  <bb 145> [local count: 313395]:
  # USE = nonlocal escaped
  # CLB = nonlocal escaped
  __assert_fail ("LexingRawMode && \"Not already in raw mode!\"",
"/usr/src/llvm-project/clang/include/clang/Lex/Lexer.h", 237, "bool
clang::Lexer::LexFromRawLexer(clang::Token&)");

  <bb 146> [local count: 783176091]:
  # p_count_732 = PHI <p_count_45(144), 0(138)>
  # Result$UintData_591 = PHI <Result$UintData_449(144),
Result$UintData_445(D)(138)>
  # Result$PtrData_270 = PHI <Result$PtrData_172(144),
Result$PtrData_443(D)(138)>
  # Result$16_552 = PHI <Result$16_670(144), Result$16_453(D)(138)>
  # USE = nonlocal escaped { D.1224204 D.1224214 } (escaped)
  # CLB = nonlocal escaped { D.1224204 D.1224214 } (escaped)
  clang::Lexer::Lex (&TheLexer, &I);
  # PT = nonlocal escaped null { D.1224204 D.1224214 } (escaped)
  _440 = TheLexer.BufferPtr;
  # PT = nonlocal escaped null { D.1224204 D.1224214 } (escaped)
  _441 = TheLexer.BufferEnd;
  if (_440 == _441)
    goto <bb 147>; [5.50%]
  else
    goto <bb 139>; [94.50%]

with bb 146 the loop header (before dom2), so I believe Result$16_552 is never
equivalent to _143, it is equivalent to _143 from previous loop's iteration,
not the current one.

Reply via email to