This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] gcse.c: Fix the header ordering.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: roger at www dot eyesopen dot com
- Date: Fri, 31 Jan 2003 12:51:43 -0500 (EST)
- Subject: [patch] gcse.c: Fix the header ordering.
Hi,
Attached is a patch to fix the header ordering in gcse.c.
While analyzing the failure of execute/20010119-1.c on H8 port, I
found that the constant propagation into conditional branches are
broken. Specifically, in constprop_register() in gcse.c, we have the
following.
rtx dest = SET_DEST (sset);
if ((REG_P (dest) || CC0_P (dest))
&& cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn), from, to))
Since rtl.h is included before insn-config.h, which contains HAVE_cc0,
CC0_P is defined to be 0, so the above "if" statement doesn't let us
call cprop_jump at all.
A quick grep shows that combine.c also uses CC0_P but includes
insn-config.h after rtl.h. I haven't seen what happens if I correct
the order.
I am going to run the testsuite with the patch below, but the problem
seems to be a little deeper. Should rtl.h include insn-config.h?
Should rtl.h give an error if insn-config.h is not included yet?
Kazu Hirata
2003-01-31 Kazu Hirata <kazu@cs.umass.edu>
* gcse.c: Include insn-config.h before rtl.h.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.232
diff -u -r1.232 gcse.c
--- gcse.c 27 Jan 2003 11:30:35 -0000 1.232
+++ gcse.c 31 Jan 2003 17:40:01 -0000
@@ -149,13 +149,13 @@
#include "tm.h"
#include "toplev.h"
+#include "insn-config.h"
#include "rtl.h"
#include "tm_p.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "flags.h"
#include "real.h"
-#include "insn-config.h"
#include "recog.h"
#include "basic-block.h"
#include "output.h"