This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch]PR rtl-optimization/42691: problematic REG_EQUAL note added to SUBREG
Done. I changed the comment. Added a testcase gcc.c-torture/execute/pr42691.c.
If I run dejagnu on the unpatched gcc, only the -Os test fails.
$make check-gc RUNTESTFLAGS="--target_board=arm-sim/thumb execute.exp=pr42691.c"
With the patch below, all flags pass.
Verified that the patch does not introduce regression.
OK?
Thanks,
Jing
ChangeLog
2010-01-14 Jing Yu <jingyu@google.com>
PR rtl-optimization/42691
* combine.c (try_combine): Clear outdated i3note when dest of I3 is
replaced.
testsuite/ChangeLog
2010-01-14 Jing Yu <jingyu@google.com>
* gcc.c-torture/execute/pr42691.c: New.
Index: testsuite/gcc.c-torture/execute/pr42691.c
===================================================================
--- testsuite/gcc.c-torture/execute/pr42691.c (revision 0)
+++ testsuite/gcc.c-torture/execute/pr42691.c (revision 0)
@@ -0,0 +1,40 @@
+extern void abort (void);
+
+union _D_rep
+{
+ unsigned short rep[4];
+ double val;
+};
+
+int add(double* key, double* table)
+{
+ unsigned i = 0;
+ double* deletedEntry = 0;
+ while (1) {
+ double* entry = table + i;
+
+ if (*entry == *key)
+ break;
+
+ union _D_rep _D_inf = {{ 0, 0, 0, 0x7ff0 }};
+ if (*entry != _D_inf.val)
+ abort ();
+
+ union _D_rep _D_inf2 = {{ 0, 0, 0, 0x7ff0 }};
+ if (!_D_inf2.val)
+ deletedEntry = entry;
+
+ i++;
+ }
+ *deletedEntry = 0.0;
+ return 0;
+}
+
+int main ()
+{
+ union _D_rep infinit = {{ 0, 0, 0, 0x7ff0 }};
+ double table[2] = { infinit.val, 23 };
+ double key = 23;
+ int ret = add (&key, table);
+ return ret;
+}
Index: combine.c
===================================================================
--- combine.c (revision 155801)
+++ combine.c (working copy)
@@ -2663,10 +2663,16 @@ try_combine (rtx i3, rtx i2, rtx i1, int
i2dest = SET_DEST (temp);
i2dest_killed = dead_or_set_p (i2, i2dest);
+ /* Replace the source in I2 with the new constant and make the
+ resulting insn the new pattern for I3. Then skip to where we
+ validate the pattern. Everything was set up above. */
SUBST (SET_SRC (temp),
immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp))));
newpat = PATTERN (i2);
+
+ /* The dest of I3 has been replaced with the dest of I2. */
+ changed_i3_dest = 1;
goto validate_replacement;
}
}
@@ -3038,8 +3044,6 @@ try_combine (rtx i3, rtx i2, rtx i1, int
}
}
- /* We come here when we are replacing a destination in I2 with the
- destination of I3. */
validate_replacement:
/* Note which hard regs this insn has as inputs. */