[Bug tree-optimization/93781] Optimizer produces suboptimal code related to -ftree-vrp

zhongyunde at huawei dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 9 03:57:02 GMT 2020


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

--- Comment #2 from vfdff <zhongyunde at huawei dot com> ---
I test a more simple testcase, and find the arg_5(D) already get the expected
range, but the _2 = 1 << arg_9 is unexpected.

unsigned int foo (unsigned int arg)
{
  unsigned int C000003FE = 4;

  if (arg + 1 < 4)  // work of for if (arg < 3)
     C000003FE = 0x1 << arg;

  return C000003FE < 5;
}

Adding assert for arg_5(D) from arg_5(D) + 1

Visiting statement:
arg_9 = ASSERT_EXPR <arg_5(D), arg_5(D) + 1 <= 3>;
Intersecting
  ~[3, 4294967294]  EQUIVALENCES: { arg_5(D) } (1 elements)
and
  VARYING
to
  ~[3, 4294967294]  EQUIVALENCES: { arg_5(D) } (1 elements)
Found new range for arg_9: ~[3, 4294967294]
marking stmt to be not simulated again

Visiting statement:
_2 = 1 << arg_9;
Meeting  ------ should be Intersecting ?
  [1, 4]
and
  VARYING
to
  VARYING
Found new range for _2: VARYING  ---------> so, _2 excepted range [1, 4] ?


More information about the Gcc-bugs mailing list