Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On 4/15/19 9:27 AM, Richard Biener wrote: > On Mon, Apr 15, 2019 at 8:48 AM Martin Liška wrote: >> >> Hi. >> >> Apparently, there's one another PR: >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90083 >> >> May I backport the patch to GCC-8 branch? > > Hmm, it isn't a regression, right? But it only > affects multi-versioning, so yes, go ahead. No, it's not. The issue is very old. > Might as well consider GCC 7 then - do you have > an overall idea of the state of the MV stuff on branches? Well, I've made quite some changes to target_clone pass (multiple_target.c). Thus I would ignore GCC-7 if possible. Martin > IIRC you've done most of the "fixes"? > > Richard. > >> Thanks, >> Martin
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Mon, Apr 15, 2019 at 8:48 AM Martin Liška wrote: > > Hi. > > Apparently, there's one another PR: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90083 > > May I backport the patch to GCC-8 branch? Hmm, it isn't a regression, right? But it only affects multi-versioning, so yes, go ahead. Might as well consider GCC 7 then - do you have an overall idea of the state of the MV stuff on branches? IIRC you've done most of the "fixes"? Richard. > Thanks, > Martin
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
Hi. Apparently, there's one another PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90083 May I backport the patch to GCC-8 branch? Thanks, Martin
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Fri, Jan 18, 2019 at 6:25 AM H.J. Lu wrote: > > On Thu, Jan 17, 2019 at 4:51 AM Richard Biener > wrote: > > > > On Thu, Jan 17, 2019 at 12:21 PM Martin Liška wrote: > > > > > > On 1/16/19 1:06 PM, Richard Biener wrote: > > > > On Wed, Jan 16, 2019 at 10:20 AM Martin Liška wrote: > > > >> > > > >> Hi. > > > >> > > > >> The patch is about resetting TYPE_MODE of vector types. This is > > > >> problematic > > > >> when an inlining among different ISAs happen. Then we end up with a > > > >> different > > > >> mode than when it's expected from debug info. > > > >> > > > >> When creating a new function decl in target_clones, we must > > > >> valid_attribute_p early > > > >> so that the declaration has a proper cl_target_.. node and so that > > > >> inliner can > > > >> fix modes. > > > >> > > > >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > > >> > > > >> Ready to be installed? > > > > > > > > I don't like the new failure mode too much. It looks like > > > > create_version_clone_with_body > > > > can fail so why not simply return NULL when > > > > targetm.target_option.valid_attribute_p > > > > returns false and handle that case in multi-versioning? > > > > > > > > That is, > > > > > > > > + return !seen_error (); > > > > > > > > that looks very wrong to me. > > > > > > Yep, update patch should be better. > > > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > > > > > Ready to be installed? > > > > OK. > > > > Thanks, > > Richard. > > > > > Thanks, > > > Martin > > > > > > > > > > > Richard. > > > > > > > >> Thanks, > > > >> Martin > > > >> > > > >> gcc/ChangeLog: > > > >> > > > >> 2019-01-16 Martin Liska > > > >> Richard Biener > > > >> > > > >> PR middle-end/88587 > > > >> * cgraph.h (create_version_clone_with_body): Add new argument > > > >> with attributes. > > > >> * cgraphclones.c (cgraph_node::create_version_clone): Add > > > >> DECL_ATTRIBUTES to a newly created decl. And call > > > >> valid_attribute_p so that proper cl_target_optimization_node > > > >> is set for the newly created declaration. > > > >> * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES > > > >> for declaration. > > > >> (expand_target_clones): Do not call valid_attribute_p, it must > > > >> be already done. > > > >> * tree-inline.c (copy_decl_for_dup_finish): Reset mode for > > > >> vector types. > > > >> > > > >> gcc/testsuite/ChangeLog: > > > >> > > > >> 2019-01-16 Martin Liska > > > >> > > > >> PR middle-end/88587 > > > >> * g++.target/i386/pr88587.C: New test. > > > >> * gcc.target/i386/mvc13.c: New test. > > > >> --- > > > >> gcc/cgraph.h| 7 +- > > > >> gcc/cgraphclones.c | 18 +- > > > >> gcc/multiple_target.c | 32 - > > > >> gcc/testsuite/g++.target/i386/pr88587.C | 15 > > > >> gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ > > > >> gcc/tree-inline.c | 4 > > > >> 6 files changed, 61 insertions(+), 24 deletions(-) > > > >> create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C > > > >> create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c > > > >> > > > >> > > > > > It is wrong to use -m32 in dg-options: > > /* { dg-do compile } */ > /* { dg-require-ifunc "" } */ > /* { dg-options "-O -m32 -g -mno-sse" } */ > > You should use > > /* { dg-do compile { target ia32 } } */ > > Since g++.target/i386/pr88587.C doesn't support -fPIC, > > [hjl@gnu-cfl-1 gcc]$ ./xgcc -B./ > /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C > -mx32 -fpic -S > /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6: > warning: always_inline function might not be inlinable [-Wattributes] > 6 | void a() > | ^ > /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C: > In function \u2018void a2()\u2019: > /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6: > error: inlining failed in call to always_inline \u2018void a()\u2019: > function body can be overwritten at link time > /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:13:5: > note: called from here >13 | a (); > | ~~^~ > [hjl@gnu-cfl-1 gcc]$ > > you should add -fno-pic. > I am checking in this patch as an obvious fix. -- H.J. --- diff --git a/gcc/testsuite/g++.target/i386/pr88587.C b/gcc/testsuite/g++.target/i386/pr88587.C index 6808ab68cbb..e7488e68743 100644 --- a/gcc/testsuite/g++.target/i386/pr88587.C +++ b/gcc/testsuite/g++.target/i386/pr88587.C @@ -1,6 +1,6 @@ -/* { dg-do compile } */ +/* { dg-do compile { target ia32 } } */ /* { dg-require-ifunc "" } */ -/* { dg-options "-O -m32 -g -mno-sse -Wno-attributes" } */ +/* { dg-options "-O -fno-pic -g
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Thu, Jan 17, 2019 at 4:51 AM Richard Biener wrote: > > On Thu, Jan 17, 2019 at 12:21 PM Martin Liška wrote: > > > > On 1/16/19 1:06 PM, Richard Biener wrote: > > > On Wed, Jan 16, 2019 at 10:20 AM Martin Liška wrote: > > >> > > >> Hi. > > >> > > >> The patch is about resetting TYPE_MODE of vector types. This is > > >> problematic > > >> when an inlining among different ISAs happen. Then we end up with a > > >> different > > >> mode than when it's expected from debug info. > > >> > > >> When creating a new function decl in target_clones, we must > > >> valid_attribute_p early > > >> so that the declaration has a proper cl_target_.. node and so that > > >> inliner can > > >> fix modes. > > >> > > >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > >> > > >> Ready to be installed? > > > > > > I don't like the new failure mode too much. It looks like > > > create_version_clone_with_body > > > can fail so why not simply return NULL when > > > targetm.target_option.valid_attribute_p > > > returns false and handle that case in multi-versioning? > > > > > > That is, > > > > > > + return !seen_error (); > > > > > > that looks very wrong to me. > > > > Yep, update patch should be better. > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > > > Ready to be installed? > > OK. > > Thanks, > Richard. > > > Thanks, > > Martin > > > > > > > > Richard. > > > > > >> Thanks, > > >> Martin > > >> > > >> gcc/ChangeLog: > > >> > > >> 2019-01-16 Martin Liska > > >> Richard Biener > > >> > > >> PR middle-end/88587 > > >> * cgraph.h (create_version_clone_with_body): Add new argument > > >> with attributes. > > >> * cgraphclones.c (cgraph_node::create_version_clone): Add > > >> DECL_ATTRIBUTES to a newly created decl. And call > > >> valid_attribute_p so that proper cl_target_optimization_node > > >> is set for the newly created declaration. > > >> * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES > > >> for declaration. > > >> (expand_target_clones): Do not call valid_attribute_p, it must > > >> be already done. > > >> * tree-inline.c (copy_decl_for_dup_finish): Reset mode for > > >> vector types. > > >> > > >> gcc/testsuite/ChangeLog: > > >> > > >> 2019-01-16 Martin Liska > > >> > > >> PR middle-end/88587 > > >> * g++.target/i386/pr88587.C: New test. > > >> * gcc.target/i386/mvc13.c: New test. > > >> --- > > >> gcc/cgraph.h| 7 +- > > >> gcc/cgraphclones.c | 18 +- > > >> gcc/multiple_target.c | 32 - > > >> gcc/testsuite/g++.target/i386/pr88587.C | 15 > > >> gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ > > >> gcc/tree-inline.c | 4 > > >> 6 files changed, 61 insertions(+), 24 deletions(-) > > >> create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C > > >> create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c > > >> > > >> > > It is wrong to use -m32 in dg-options: /* { dg-do compile } */ /* { dg-require-ifunc "" } */ /* { dg-options "-O -m32 -g -mno-sse" } */ You should use /* { dg-do compile { target ia32 } } */ Since g++.target/i386/pr88587.C doesn't support -fPIC, [hjl@gnu-cfl-1 gcc]$ ./xgcc -B./ /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C -mx32 -fpic -S /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6: warning: always_inline function might not be inlinable [-Wattributes] 6 | void a() | ^ /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C: In function \u2018void a2()\u2019: /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:6:6: error: inlining failed in call to always_inline \u2018void a()\u2019: function body can be overwritten at link time /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.target/i386/pr88587.C:13:5: note: called from here 13 | a (); | ~~^~ [hjl@gnu-cfl-1 gcc]$ you should add -fno-pic. -- H.J.
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Thu, Jan 17, 2019 at 12:21 PM Martin Liška wrote: > > On 1/16/19 1:06 PM, Richard Biener wrote: > > On Wed, Jan 16, 2019 at 10:20 AM Martin Liška wrote: > >> > >> Hi. > >> > >> The patch is about resetting TYPE_MODE of vector types. This is problematic > >> when an inlining among different ISAs happen. Then we end up with a > >> different > >> mode than when it's expected from debug info. > >> > >> When creating a new function decl in target_clones, we must > >> valid_attribute_p early > >> so that the declaration has a proper cl_target_.. node and so that inliner > >> can > >> fix modes. > >> > >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > >> > >> Ready to be installed? > > > > I don't like the new failure mode too much. It looks like > > create_version_clone_with_body > > can fail so why not simply return NULL when > > targetm.target_option.valid_attribute_p > > returns false and handle that case in multi-versioning? > > > > That is, > > > > + return !seen_error (); > > > > that looks very wrong to me. > > Yep, update patch should be better. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? OK. Thanks, Richard. > Thanks, > Martin > > > > > Richard. > > > >> Thanks, > >> Martin > >> > >> gcc/ChangeLog: > >> > >> 2019-01-16 Martin Liska > >> Richard Biener > >> > >> PR middle-end/88587 > >> * cgraph.h (create_version_clone_with_body): Add new argument > >> with attributes. > >> * cgraphclones.c (cgraph_node::create_version_clone): Add > >> DECL_ATTRIBUTES to a newly created decl. And call > >> valid_attribute_p so that proper cl_target_optimization_node > >> is set for the newly created declaration. > >> * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES > >> for declaration. > >> (expand_target_clones): Do not call valid_attribute_p, it must > >> be already done. > >> * tree-inline.c (copy_decl_for_dup_finish): Reset mode for > >> vector types. > >> > >> gcc/testsuite/ChangeLog: > >> > >> 2019-01-16 Martin Liska > >> > >> PR middle-end/88587 > >> * g++.target/i386/pr88587.C: New test. > >> * gcc.target/i386/mvc13.c: New test. > >> --- > >> gcc/cgraph.h| 7 +- > >> gcc/cgraphclones.c | 18 +- > >> gcc/multiple_target.c | 32 - > >> gcc/testsuite/g++.target/i386/pr88587.C | 15 > >> gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ > >> gcc/tree-inline.c | 4 > >> 6 files changed, 61 insertions(+), 24 deletions(-) > >> create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C > >> create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c > >> > >> >
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On 1/16/19 1:06 PM, Richard Biener wrote: > On Wed, Jan 16, 2019 at 10:20 AM Martin Liška wrote: >> >> Hi. >> >> The patch is about resetting TYPE_MODE of vector types. This is problematic >> when an inlining among different ISAs happen. Then we end up with a different >> mode than when it's expected from debug info. >> >> When creating a new function decl in target_clones, we must >> valid_attribute_p early >> so that the declaration has a proper cl_target_.. node and so that inliner >> can >> fix modes. >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >> Ready to be installed? > > I don't like the new failure mode too much. It looks like > create_version_clone_with_body > can fail so why not simply return NULL when > targetm.target_option.valid_attribute_p > returns false and handle that case in multi-versioning? > > That is, > > + return !seen_error (); > > that looks very wrong to me. Yep, update patch should be better. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin > > Richard. > >> Thanks, >> Martin >> >> gcc/ChangeLog: >> >> 2019-01-16 Martin Liska >> Richard Biener >> >> PR middle-end/88587 >> * cgraph.h (create_version_clone_with_body): Add new argument >> with attributes. >> * cgraphclones.c (cgraph_node::create_version_clone): Add >> DECL_ATTRIBUTES to a newly created decl. And call >> valid_attribute_p so that proper cl_target_optimization_node >> is set for the newly created declaration. >> * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES >> for declaration. >> (expand_target_clones): Do not call valid_attribute_p, it must >> be already done. >> * tree-inline.c (copy_decl_for_dup_finish): Reset mode for >> vector types. >> >> gcc/testsuite/ChangeLog: >> >> 2019-01-16 Martin Liska >> >> PR middle-end/88587 >> * g++.target/i386/pr88587.C: New test. >> * gcc.target/i386/mvc13.c: New test. >> --- >> gcc/cgraph.h| 7 +- >> gcc/cgraphclones.c | 18 +- >> gcc/multiple_target.c | 32 - >> gcc/testsuite/g++.target/i386/pr88587.C | 15 >> gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ >> gcc/tree-inline.c | 4 >> 6 files changed, 61 insertions(+), 24 deletions(-) >> create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C >> create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c >> >> >From 3deeb24418fa5078a407ff6fee6d9d958b9ea869 Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 16 Jan 2019 09:05:02 +0100 Subject: [PATCH] Reset proper type on vector types (PR middle-end/88587). gcc/ChangeLog: 2019-01-16 Martin Liska Richard Biener PR middle-end/88587 * cgraph.h (create_version_clone_with_body): Add new argument with attributes. * cgraphclones.c (cgraph_node::create_version_clone): Add DECL_ATTRIBUTES to a newly created decl. And call valid_attribute_p so that proper cl_target_optimization_node is set for the newly created declaration. * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES for declaration. (expand_target_clones): Do not call valid_attribute_p, it must be already done. * tree-inline.c (copy_decl_for_dup_finish): Reset mode for vector types. gcc/testsuite/ChangeLog: 2019-01-16 Martin Liska PR middle-end/88587 * g++.target/i386/pr88587.C: New test. * gcc.target/i386/mvc13.c: New test. --- gcc/cgraph.h| 7 - gcc/cgraphclones.c | 20 +- gcc/multiple_target.c | 36 ++--- gcc/testsuite/g++.target/i386/pr88587.C | 15 +++ gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ gcc/tree-inline.c | 4 +++ 6 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c diff --git a/gcc/cgraph.h b/gcc/cgraph.h index c016da3875c..bb231833328 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1019,12 +1019,17 @@ public: If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. If non_NULL NEW_ENTRY determine new entry BB of the clone. + If TARGET_ATTRIBUTES is non-null, when creating a new declaration, + add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p + that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET + of the declaration. + Return the new version's cgraph node. */ cgraph_node *create_version_clone_with_body (vec redirect_callers, vec *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *clone_name); + const char *clone_name,
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Wed, Jan 16, 2019 at 10:20 AM Martin Liška wrote: > > Hi. > > The patch is about resetting TYPE_MODE of vector types. This is problematic > when an inlining among different ISAs happen. Then we end up with a different > mode than when it's expected from debug info. > > When creating a new function decl in target_clones, we must valid_attribute_p > early > so that the declaration has a proper cl_target_.. node and so that inliner can > fix modes. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? I don't like the new failure mode too much. It looks like create_version_clone_with_body can fail so why not simply return NULL when targetm.target_option.valid_attribute_p returns false and handle that case in multi-versioning? That is, + return !seen_error (); that looks very wrong to me. Richard. > Thanks, > Martin > > gcc/ChangeLog: > > 2019-01-16 Martin Liska > Richard Biener > > PR middle-end/88587 > * cgraph.h (create_version_clone_with_body): Add new argument > with attributes. > * cgraphclones.c (cgraph_node::create_version_clone): Add > DECL_ATTRIBUTES to a newly created decl. And call > valid_attribute_p so that proper cl_target_optimization_node > is set for the newly created declaration. > * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES > for declaration. > (expand_target_clones): Do not call valid_attribute_p, it must > be already done. > * tree-inline.c (copy_decl_for_dup_finish): Reset mode for > vector types. > > gcc/testsuite/ChangeLog: > > 2019-01-16 Martin Liska > > PR middle-end/88587 > * g++.target/i386/pr88587.C: New test. > * gcc.target/i386/mvc13.c: New test. > --- > gcc/cgraph.h| 7 +- > gcc/cgraphclones.c | 18 +- > gcc/multiple_target.c | 32 - > gcc/testsuite/g++.target/i386/pr88587.C | 15 > gcc/testsuite/gcc.target/i386/mvc13.c | 9 +++ > gcc/tree-inline.c | 4 > 6 files changed, 61 insertions(+), 24 deletions(-) > create mode 100644 gcc/testsuite/g++.target/i386/pr88587.C > create mode 100644 gcc/testsuite/gcc.target/i386/mvc13.c > >
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Wed, Jan 16, 2019 at 12:59 PM Jakub Jelinek wrote: > > On Wed, Jan 16, 2019 at 12:50:23PM +0100, Richard Biener wrote: > > I guess so. There's not much we can do about this other than making > > DECL_MODE dynamic the same way as TYPE_MODE. I still believe > > this is the wrong direction and instead RTL expansion should properly > > adjust DECL_RTL and generally on GIMPLE we shouldn't need to > > commit to modes early at all... > > Are there cases where DECL_MODE (decl) should not be equal to > TYPE_MODE (TREE_TYPE (decl))? Is that for structs with flexible array > members where the initializer is filling up the flexible array member, or > something different? ISTR seeing the most differences in FIELD_DECL modes (bitfields? packed fields getting BLKmode but types not being packed/etc.?) > E.g. in expand_debug* it shouldn't be hard to use TYPE_MODE if > VECTOR_TYPE_P (TREE_TYPE (decl)), but there are many other uses of > DECL_MODE. > > Jakub
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Wed, Jan 16, 2019 at 12:50:23PM +0100, Richard Biener wrote: > I guess so. There's not much we can do about this other than making > DECL_MODE dynamic the same way as TYPE_MODE. I still believe > this is the wrong direction and instead RTL expansion should properly > adjust DECL_RTL and generally on GIMPLE we shouldn't need to > commit to modes early at all... Are there cases where DECL_MODE (decl) should not be equal to TYPE_MODE (TREE_TYPE (decl))? Is that for structs with flexible array members where the initializer is filling up the flexible array member, or something different? E.g. in expand_debug* it shouldn't be hard to use TYPE_MODE if VECTOR_TYPE_P (TREE_TYPE (decl)), but there are many other uses of DECL_MODE. Jakub
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
On Wed, Jan 16, 2019 at 10:26 AM Martin Liška wrote: > > And there's patch with Richi's validation check that he provided. > It fails on following 2 tests in test-suite: > > $ ./xgcc -B. > /home/marxin/Programming/gcc/gcc/testsuite/gcc.target/i386/pr68674.c > DECL_MODE BLK vs TYPE_MODE V8SI [V8SI]: a > ... > > $ ./xgcc -B. > /home/marxin/Programming/gcc/gcc/testsuite/gcc.target/i386/pr80583.c -c > DECL_MODE BLK vs TYPE_MODE V8SI [V8SI]: a > ... > > In both cases we access a global variable from a function with a different > target > attributes. I guess Honza has seen that in inliner. > > What to do with these, can it be potentially dangerous? I guess so. There's not much we can do about this other than making DECL_MODE dynamic the same way as TYPE_MODE. I still believe this is the wrong direction and instead RTL expansion should properly adjust DECL_RTL and generally on GIMPLE we shouldn't need to commit to modes early at all... [but then we eventually want to expose more ABI details to GIMPLE] Richard. > > Thanks, > Martin >
Re: [PATCH] Reset proper type on vector types (PR middle-end/88587).
And there's patch with Richi's validation check that he provided. It fails on following 2 tests in test-suite: $ ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gcc.target/i386/pr68674.c DECL_MODE BLK vs TYPE_MODE V8SI [V8SI]: a ... $ ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gcc.target/i386/pr80583.c -c DECL_MODE BLK vs TYPE_MODE V8SI [V8SI]: a ... In both cases we access a global variable from a function with a different target attributes. I guess Honza has seen that in inliner. What to do with these, can it be potentially dangerous? Thanks, Martin >From bf22210f96a2ead9d50e351102f095aadf9d879f Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 16 Jan 2019 09:05:21 +0100 Subject: [PATCH] Sanitize about VECTOR_TYPEs. --- gcc/tree-cfg.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 6041f4208b0..fc1dd36fbb7 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5108,6 +5108,17 @@ verify_node_sharing_1 (tree *tp, int *walk_subtrees, void *data) { hash_set *visited = (hash_set *) data; + if (DECL_P (*tp) + && VECTOR_TYPE_P (TREE_TYPE (*tp)) + && DECL_MODE (*tp) != TYPE_MODE (TREE_TYPE (*tp))) +{ + fprintf (stderr, "DECL_MODE %s vs TYPE_MODE %s [%s]: ", + mode_name[DECL_MODE (*tp)], + mode_name[TYPE_MODE (TREE_TYPE (*tp))], + mode_name[TYPE_MODE_RAW (TREE_TYPE (*tp))]); + print_generic_expr (stderr, *tp); + fprintf (stderr, "\n"); +} if (tree_node_can_be_shared (*tp)) { *walk_subtrees = false; -- 2.20.1