PR debug/42631
* web.c (entry_register): Don't clobber the number of the
first uninitialized reference in used[].
testsuite/
PR debug/42631
* gcc.dg/pr42631.c: Update test.
* gcc.dg/pr42631-2.c: New test.
===================================================================
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funroll-loops -fdump-rtl-web" } */
+
+foo()
+{
+}
+
+/* { dg-final { scan-rtl-dump-not "Web oldreg" "web" } } */
+/* { dg-final { cleanup-rtl-dump "web" } } */
===================================================================
@@ -14,10 +14,13 @@
combine uninitialized uses into a single web. */
/* { dg-do compile } */
-/* { dg-options "-g -O1 -funroll-loops -fcompare-debug" } */
+/* { dg-options "-g -O1 -funroll-loops -fcompare-debug -fdump-rtl-web" } */
void foo()
{
unsigned k;
while (--k > 0);
}
+
+/* { dg-final { scan-rtl-dump-not "Web oldreg" "web" } } */
+/* { dg-final { cleanup-rtl-dump "web" } } */
===================================================================
@@ -260,7 +260,11 @@ entry_register (struct web_entry *entry,
and there won't be any use for the other values when we get to
this point. */
if (used[REGNO (reg)] != 1)
- newreg = reg, used[REGNO (reg)] = 1;
+ {
+ newreg = reg;
+ if (!used[REGNO (reg)])
+ used[REGNO (reg)] = 1;
+ }
else
{
newreg = gen_reg_rtx (GET_MODE (reg));