Message ID | 0EC213FB-C1C3-4E10-83EB-AAC8412D7074@oracle.com |
---|---|
State | New |
Headers | show |
Series | Fix PR81422[aarch64] internal compiler error: in update_equiv_regs, at ira.c:3425 | expand |
Ping https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg173877.html > On Sep 19, 2017, at 2:22 PM, Qing Zhao <qing.zhao@oracle.com> wrote: > > Hi, > > This patch fixes the aarch64 bug 81422 > https://gcc.gnu.org/PR81422 > > Before adding REG_EQUIV notes in the TLS symbol handling code, > we should check whether the "dest" is a REG or NOT (sometimes, > it's a SUBREG as in this bug). Only when the “dest” is a REG, the note > will be added. > > a new small testing case is added. > > this change has been tested on aarch64-unknown-linux-gnu with no regression. > > Thanks! > > Qing > > > =============== > > gcc/ChangeLog: > > * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): > check whether the dest is REG before adding REG_EQUIV note. > > gcc/testsuite/ChangeLog: > > PR target/81422 > * gcc.target/aarch64/pr81422.C: New test. > > --- > gcc/config/aarch64/aarch64.c | 12 ++++++++---- > gcc/testsuite/gcc.target/aarch64/pr81422.C | 15 +++++++++++++++ > 2 files changed, 23 insertions(+), 4 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/aarch64/pr81422.C > > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index a2ecd7a..6c3ef76 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -1480,7 +1480,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, > tp = gen_lowpart (mode, tp); > > emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, x0))); > - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > + if (REG_P (dest)) > + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > return; > } > > @@ -1514,7 +1515,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, > } > > emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, tmp_reg))); > - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > + if (REG_P (dest)) > + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > return; > } > > @@ -1555,7 +1557,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, > gcc_unreachable (); > } > > - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > + if (REG_P (dest)) > + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > return; > } > > @@ -1584,7 +1587,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, > emit_insn (gen_tlsie_tiny_sidi (dest, imm, tp)); > } > > - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > + if (REG_P (dest)) > + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); > return; > } > > diff --git a/gcc/testsuite/gcc.target/aarch64/pr81422.C b/gcc/testsuite/gcc.target/aarch64/pr81422.C > new file mode 100644 > index 0000000..5bcc948 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/pr81422.C > @@ -0,0 +1,15 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O0" } */ > + > +struct DArray > +{ > + __SIZE_TYPE__ length; > + int* ptr; > +}; > + > +void foo35(DArray) > +{ > + static __thread int x[5]; > + foo35({5, (int*)&x}); > +} > + > -- > 1.9.1 >
HI, Richard, > On Oct 5, 2017, at 9:53 AM, Richard Earnshaw (lists) <Richard.Earnshaw@arm.com> wrote: > > Two minor nits to fix: > > - ChangeLog entries should start with a capital letter (s/check/Check/). > - Please use hard tabs rather than 8 consecutive spaces (each of your > new 'if' statements). > > OK with those changes. > > R. Per your comments, my updated patch is following: since I don’t have the SVN write permission, if the change is good, could you help me to check them in? thanks a lot. Qing =============== gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Check whether the dest is REG before adding REG_EQUIV note. gcc/testsuite/ChangeLog: PR target/81422 * gcc.target/aarch64/pr81422.C: New test. --- gcc/config/aarch64/aarch64.c | 12 ++++++++---- gcc/testsuite/gcc.target/aarch64/pr81422.C | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr81422.C diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index ee98a1f..181f66a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1490,7 +1490,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, tp = gen_lowpart (mode, tp); emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, x0))); - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1524,7 +1525,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, } emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, tmp_reg))); - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1565,7 +1567,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, gcc_unreachable (); } - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1594,7 +1597,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, emit_insn (gen_tlsie_tiny_sidi (dest, imm, tp)); } - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } diff --git a/gcc/testsuite/gcc.target/aarch64/pr81422.C b/gcc/testsuite/gcc.target/aarch64/pr81422.C new file mode 100644 index 0000000..5bcc948 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr81422.C @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +struct DArray +{ + __SIZE_TYPE__ length; + int* ptr; +}; + +void foo35(DArray) +{ + static __thread int x[5]; + foo35({5, (int*)&x}); +} +
=============== gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): check whether the dest is REG before adding REG_EQUIV note. gcc/testsuite/ChangeLog: PR target/81422 * gcc.target/aarch64/pr81422.C: New test. --- gcc/config/aarch64/aarch64.c | 12 ++++++++---- gcc/testsuite/gcc.target/aarch64/pr81422.C | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr81422.C diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index a2ecd7a..6c3ef76 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1480,7 +1480,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, tp = gen_lowpart (mode, tp); emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, x0))); - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1514,7 +1515,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, } emit_insn (gen_rtx_SET (dest, gen_rtx_PLUS (mode, tp, tmp_reg))); - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1555,7 +1557,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, gcc_unreachable (); } - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } @@ -1584,7 +1587,8 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, emit_insn (gen_tlsie_tiny_sidi (dest, imm, tp)); } - set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); + if (REG_P (dest)) + set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; } diff --git a/gcc/testsuite/gcc.target/aarch64/pr81422.C b/gcc/testsuite/gcc.target/aarch64/pr81422.C new file mode 100644 index 0000000..5bcc948 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr81422.C @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +struct DArray +{ + __SIZE_TYPE__ length; + int* ptr; +}; + +void foo35(DArray) +{ + static __thread int x[5]; + foo35({5, (int*)&x}); +} +