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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue for this seems to be that create_mem_ref gets

  type = unsigned long
  offset = 0
  elements = {
    [0] = &e *
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd,
 
    [1] = (sizetype) a.9_30 * 232, 
    [2] = ivtmp.28_44 * 4
  }

via get_computation_aff and addr_to_parts fills out no suitable symbol/base

$113 = {symbol = <tree 0x0>, base = <plus_expr 0x7ffff73b30f0>, 
  index = <nop_expr 0x7ffff73af9a0>, step = <integer_cst 0x7ffff71e4000>, 
  offset = <tree 0x0>}

so we hit

  else /* !POINTER_TYPE_P */
    {
      base = build_int_cst (build_pointer_type (type), 0);
      index2 = addr->base;

in create_mem_ref_raw.

But get_address_cost sees the address split as aff_inv

  type = unsigned long
  offset = 0
  elements = {
    [0] = &e *
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd,
 
    [1] = (sizetype) a.9_30 * 232
  }

and aff_var

  type = unsigned long
  offset = 0
  elements = {
    [0] = ivtmp.28 * 4
  }

and eventually ends up with parts

$108 = {symbol = <tree 0x0>, base = <integer_cst 0x7ffff71e4150>, 
  index = <integer_cst 0x7ffff71e4150>, step = <integer_cst 0x7ffff73b05e8>, 
  offset = <tree 0x0>}

so the address we cost is different from the address we eventually generate
(the address we cost doesn't contain all parts - we ignore aff_var).

Reply via email to