[Bug tree-optimization/87325] determine_base_object does not consider consider address space of base expr
amker at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 18 06:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87325
--- Comment #2 from bin cheng <amker at gcc dot gnu.org> ---
Seems alloc_iv doesn't infer base object correctly:
/* Lower address expression in base except ones with DECL_P as operand.
By doing this:
1) More accurate cost can be computed for address expressions;
2) Duplicate candidates won't be created for bases in different
forms, like &a[0] and &a. */
STRIP_NOPS (expr);
if ((TREE_CODE (expr) == ADDR_EXPR && !DECL_P (TREE_OPERAND (expr, 0)))
|| contain_complex_addr_expr (expr))
{
aff_tree comb;
tree_to_aff_combination (expr, TREE_TYPE (expr), &comb);
base = fold_convert (TREE_TYPE (base), aff_combination_to_tree (&comb));
}
iv->base = base;
iv->base_object = determine_base_object (base);
Given:
(gdb) call debug_generic_expr(expr)
&ts[1].y
in which "ts" is a VAR_DECL in specific address space:
(gdb) call debug_generic_expr(*addr_p)
ts
(gdb) p (*addr_p)->base.code
$8 = VAR_DECL
(gdb) p (*addr_p)->typed.type->base.u.bits.address_space
$10 = 7
Question is, should be build appropriate pointer type for "ts[1].y", for now,
base = build_fold_addr_expr (base);
returns:
(gdb) call debug_generic_expr(base)
&ts[1].y
(gdb) call debug_generic_expr(base->typed.type)
float *
Thanks
More information about the Gcc-bugs
mailing list