[PATCH] Fix a bad regmove transformation - SPEC CPU2k 186.crafty regression on dataflow branch.
Seongbae Park
seongbae.park@gmail.com
Thu Mar 22 02:41:00 GMT 2007
Hi,
This fixes a miscompare in 186.crafty of SPEC CPU2000 on dataflow branch.
The mainline doesn't suffer from it, but the code is the same
so I think I should apply the patch to the mainline.
The problem was that given:
(insn:A (set (reg 101) ...))
(insn:B (clobber (reg 102)))
(insn:C (set (reg 101) (... (reg 102) ...) ))
the backward pass in regmove ended up replacing insn:A's
reg 101 with reg 102, without noticing insn:B's clobber of reg 102.
I'm not sure how to produce a small testcase for this problem though.
This change has been bootstrapped and regtested on x86-64
on dataflow branch, and I'm bootstrapping the mainline with the patch now.
2007-03-21 Seongbae Park <seongbae.park@gmail.com>
* regmove.c (regmove_optimize): Use REG_MENTIONED_P
instead of REG_OVERLAP_MENTIONED_P for DST.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"
-------------- next part --------------
Index: gcc/regmove.c
===================================================================
--- gcc/regmove.c (revision 123123)
+++ gcc/regmove.c (working copy)
@@ -1429,8 +1429,13 @@ regmove_optimize (rtx f, int nregs)
break;
}
+ /* REG_OVERLAP_MENTIONED_P returns false
+ if REG is written but not read by the rtx P.
+ However, we want to check for any writes to DST
+ because we're going to extend the live range of DST
+ so that it lives over the insn P. */
if (reg_overlap_mentioned_p (src, PATTERN (p))
- || reg_overlap_mentioned_p (dst, PATTERN (p)))
+ || reg_mentioned_p (dst, PATTERN (p)))
break;
/* If we have passed a call instruction, and the
More information about the Gcc-patches
mailing list