Message ID | 1444280375-20866-10-git-send-email-rth@redhat.com |
---|---|
State | New |
Headers | show |
On Thu, Oct 8, 2015 at 12:59 PM, Richard Henderson <rth@redhat.com> wrote: > This is the patch that richi includes in the PR. There will need to > be an additional patch to solve an ICE for the AVR backend, as noted > in the PR, but this is good enough to solve the bad-code generation > problem for the i386 backend. Hi Richard, For the record, the root cause is in IVO because it fails to preserve base object. This patch can only paper over the issue for address spaces where PTR type and sizetype have the same length, otherwise IVO generates wrong code which can't be walked around by this patch. I will take PR66768. Thanks, bin > > > * tree-ssa-address.c (create_mem_ref_raw): Retain the correct > type for the address base. > --- > gcc/tree-ssa-address.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c > index 042f9c9..bd10ae7 100644 > --- a/gcc/tree-ssa-address.c > +++ b/gcc/tree-ssa-address.c > @@ -388,7 +388,7 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr, > } > else > { > - base = build_int_cst (ptr_type_node, 0); > + base = build_int_cst (build_pointer_type (type), 0); > index2 = addr->base; > } > > -- > 2.4.3 >
On 10/08/2015 07:17 AM, Bin.Cheng wrote: > On Thu, Oct 8, 2015 at 12:59 PM, Richard Henderson <rth@redhat.com> wrote: >> This is the patch that richi includes in the PR. There will need to >> be an additional patch to solve an ICE for the AVR backend, as noted >> in the PR, but this is good enough to solve the bad-code generation >> problem for the i386 backend. > Hi Richard, > For the record, the root cause is in IVO because it fails to preserve > base object. This patch can only paper over the issue for address > spaces where PTR type and sizetype have the same length, otherwise IVO > generates wrong code which can't be walked around by this patch. I > will take PR66768. Hmm. In 2012 I submitted a patch "Preserve pointer types in ivopts", which got lost in review. It was for a different problem than address spaces, but it might be worth taking a look whether that approach could help solve this issue. Bernd
On Thu, Oct 8, 2015 at 5:55 PM, Bernd Schmidt <bschmidt@redhat.com> wrote: > On 10/08/2015 07:17 AM, Bin.Cheng wrote: >> >> On Thu, Oct 8, 2015 at 12:59 PM, Richard Henderson <rth@redhat.com> wrote: >>> >>> This is the patch that richi includes in the PR. There will need to >>> be an additional patch to solve an ICE for the AVR backend, as noted >>> in the PR, but this is good enough to solve the bad-code generation >>> problem for the i386 backend. >> >> Hi Richard, >> For the record, the root cause is in IVO because it fails to preserve >> base object. This patch can only paper over the issue for address >> spaces where PTR type and sizetype have the same length, otherwise IVO >> generates wrong code which can't be walked around by this patch. I >> will take PR66768. > > > Hmm. In 2012 I submitted a patch "Preserve pointer types in ivopts", which > got lost in review. It was for a different problem than address spaces, but > it might be worth taking a look whether that approach could help solve this > issue. Hi Bernd, Thanks for your suggestion, I will search for that patch. Thanks, bin > > > Bernd
On Thu, Oct 8, 2015 at 6:59 AM, Richard Henderson <rth@redhat.com> wrote: > This is the patch that richi includes in the PR. There will need to > be an additional patch to solve an ICE for the AVR backend, as noted > in the PR, but this is good enough to solve the bad-code generation > problem for the i386 backend. For the record, it's obvious. Thanks, Richard. > > * tree-ssa-address.c (create_mem_ref_raw): Retain the correct > type for the address base. > --- > gcc/tree-ssa-address.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c > index 042f9c9..bd10ae7 100644 > --- a/gcc/tree-ssa-address.c > +++ b/gcc/tree-ssa-address.c > @@ -388,7 +388,7 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr, > } > else > { > - base = build_int_cst (ptr_type_node, 0); > + base = build_int_cst (build_pointer_type (type), 0); > index2 = addr->base; > } > > -- > 2.4.3 >
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index 042f9c9..bd10ae7 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -388,7 +388,7 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr, } else { - base = build_int_cst (ptr_type_node, 0); + base = build_int_cst (build_pointer_type (type), 0); index2 = addr->base; }