diff options
author | Kewen Lin <linkw@linux.ibm.com> | 2022-05-24 01:00:22 -0500 |
---|---|---|
committer | Kewen Lin <linkw@linux.ibm.com> | 2022-05-24 01:00:22 -0500 |
commit | 149d04ccbb908b3a251485b43faf204752942b9f (patch) | |
tree | d3ff209c92b6ce00e98a20cd108eb7f3a7008b31 | |
parent | 168fc8bda14e2ec24c17d19630cec29fc646ed2f (diff) | |
download | gcc-149d04ccbb908b3a251485b43faf204752942b9f.zip gcc-149d04ccbb908b3a251485b43faf204752942b9f.tar.gz gcc-149d04ccbb908b3a251485b43faf204752942b9f.tar.bz2 |
rs6000: Skip debug insns for union [PR105627]
As PR105627 exposes, pass analyze_swaps should skip debug
insn when doing unionfind_union. One debug insn can use
several pseudos, if we take debug insn into account, we can
union those insns defining them and generate some unexpected
unions.
Based on the assumption that it's impossible to have one
pseudo which is defined by one debug insn but is used by one
nondebug insn, we just asserts debug insn never shows up in
function union_defs.
PR target/105627
gcc/ChangeLog:
* config/rs6000/rs6000-p8swap.cc (union_defs): Assert def_insn can't
be a debug insn.
(union_uses): Skip debug use_insn.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr105627.c: New test.
-rw-r--r-- | gcc/config/rs6000/rs6000-p8swap.cc | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/pr105627.c | 26 |
2 files changed, 32 insertions, 4 deletions
diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc index d301bc3..275702f 100644 --- a/gcc/config/rs6000/rs6000-p8swap.cc +++ b/gcc/config/rs6000/rs6000-p8swap.cc @@ -214,8 +214,9 @@ union_defs (swap_web_entry *insn_entry, rtx insn, df_ref use) if (DF_REF_INSN_INFO (link->ref)) { rtx def_insn = DF_REF_INSN (link->ref); - (void)unionfind_union (insn_entry + INSN_UID (insn), - insn_entry + INSN_UID (def_insn)); + gcc_assert (NONDEBUG_INSN_P (def_insn)); + unionfind_union (insn_entry + INSN_UID (insn), + insn_entry + INSN_UID (def_insn)); } link = link->next; @@ -242,8 +243,9 @@ union_uses (swap_web_entry *insn_entry, rtx insn, df_ref def) if (DF_REF_INSN_INFO (link->ref)) { rtx use_insn = DF_REF_INSN (link->ref); - (void)unionfind_union (insn_entry + INSN_UID (insn), - insn_entry + INSN_UID (use_insn)); + if (NONDEBUG_INSN_P (use_insn)) + unionfind_union (insn_entry + INSN_UID (insn), + insn_entry + INSN_UID (use_insn)); } link = link->next; diff --git a/gcc/testsuite/gcc.target/powerpc/pr105627.c b/gcc/testsuite/gcc.target/powerpc/pr105627.c new file mode 100644 index 0000000..bafb31f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr105627.c @@ -0,0 +1,26 @@ +/* Specify -w to disable some warnings, such as: -Wpsabi. */ +/* { dg-options "-Og -fcompare-debug -mdejagnu-cpu=power8 -w" } */ + +typedef unsigned char __attribute__ ((__vector_size__ (8))) U; +typedef unsigned char __attribute__ ((__vector_size__ (64))) V; + +U u; +char c; +V v; + +V +foo (void) +{ + V w = c + & __builtin_shufflevector (u, (V){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5}, + 24, 24, 41, 45, 53, 60, 22, 35, 45, 12, 61, + 9, 52, 15, 44, 46, 5, 5, 1, 0, 4, 9, 0, 8, 5, + 7, 2, 5, 9, 2, 7, 7, 5, 6, 0, 2, 6, 1, 7, 7, + 0, 4, 0, 1, 7, 2, 5, 3, 2, 3, 5, 6, 6, 6, 0, + 6, 1, 9, 0, 5, 4, 3, 5, 4); + w = w + v; + return w; +} + |