public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1092] regrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041]
@ 2022-06-14 17:39 Segher Boessenkool
0 siblings, 0 replies; only message in thread
From: Segher Boessenkool @ 2022-06-14 17:39 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3e16b4359e86b36676ed01219e6deafa95f3c16b
commit r13-1092-g3e16b4359e86b36676ed01219e6deafa95f3c16b
Author: Surya Kumari Jangala <jskumari@linux.vnet.ibm.com>
Date: Fri Jun 10 19:52:57 2022 +0530
regrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041]
In check_new_reg_p, the nregs of a du chain is computed by obtaining the
MODE of the first element in the chain, and then calling
hard_regno_nregs() with the MODE. But the first element of the chain can
be a DEBUG_INSN whose mode need not be the same as the rest of the
elements in the du chain. This was resulting in fcompare-debug failure
as check_new_reg_p was returning a different result with -g for the same
candidate register. We can instead obtain nregs from the du chain
itself.
2022-06-10 Surya Kumari Jangala <jskumari@linux.ibm.com>
gcc/
PR rtl-optimization/105041
* regrename.cc (check_new_reg_p): Use nregs value from du chain.
gcc/testsuite/
PR rtl-optimization/105041
* gcc.target/powerpc/pr105041.c: New test.
Diff:
---
gcc/regrename.cc | 3 +--
gcc/testsuite/gcc.target/powerpc/pr105041.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/gcc/regrename.cc b/gcc/regrename.cc
index 10271e1b17d..f65135151d8 100644
--- a/gcc/regrename.cc
+++ b/gcc/regrename.cc
@@ -324,8 +324,7 @@ static bool
check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg,
class du_head *this_head, HARD_REG_SET this_unavailable)
{
- machine_mode mode = GET_MODE (*this_head->first->loc);
- int nregs = hard_regno_nregs (new_reg, mode);
+ int nregs = this_head->nregs;
int i;
struct du_chain *tmp;
diff --git a/gcc/testsuite/gcc.target/powerpc/pr105041.c b/gcc/testsuite/gcc.target/powerpc/pr105041.c
new file mode 100644
index 00000000000..e5144b293a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr105041.c
@@ -0,0 +1,22 @@
+/* { dg-options "-mdejagnu-cpu=power4 -O2 -fcompare-debug -fharden-compares -frename-registers" } */
+
+double m;
+int n;
+
+unsigned int
+foo (unsigned int x, int y)
+{
+ long long int a = y, b = !a;
+ int c = 0;
+
+ if (b != x)
+ while ((int) m == a)
+ {
+ c = a;
+ a = 0;
+ }
+
+ n = b = y;
+
+ return x + c;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-14 17:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 17:39 [gcc r13-1092] regrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041] Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).