This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Optimizer bug related to function pointers
- To: Kevin Buettner <kevinb at cygnus dot com>
- Subject: Re: Optimizer bug related to function pointers
- From: Richard Henderson <rth at cygnus dot com>
- Date: Fri, 8 Sep 2000 01:50:27 -0700
- Cc: Jim Wilson <wilson at cygnus dot com>, Geoffrey Keating <geoffk at cygnus dot com>, Bernd Schmidt <bernds at cygnus dot com>, gcc-patches at gcc dot gnu dot org
- References: <1000908063938.ZM27193@ocotillo.lan> <20000907234356.A2330@cygnus.com> <rth@cygnus.com> <1000908070922.ZM27251@ocotillo.lan>
On Fri, Sep 08, 2000 at 12:09:22AM -0700, Kevin Buettner wrote:
> I have this ChangeLog entry in my sources. Also, I updated and
> rebuilt earlier in the week. So, unless I'm doing something really
> stupid, my guess is that it's a different bug.
You're right, it is a different bug. This appears to be fallout from
2000-09-06 Bernd Schmidt <bernds@redhat.co.uk>
* cse.c: Include "basic-block.h".
(struct table_elt): New field REGCOST.
(CHEAP_REG): Delete macro.
(COST): Return 0 for REGs.
...
as far as I can tell, function symbols were only accidentally not
cse'd previously. Certainly nothing actively prevented it.
This fixes the test case on ia64. I'm interested in opinions on
whether this is the best solution.
r~
static void message (char *);
static void
init (void (**fp)(char *))
{
*fp = message;
message ("from init");
}
* cse.c (fold_rtx): Enforce NO_FUNCTION_CSE on CALL patterns.
Index: cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.156
diff -c -p -d -r1.156 cse.c
*** cse.c 2000/09/06 09:20:37 1.156
--- cse.c 2000/09/08 08:41:16
*************** fold_rtx (x, insn)
*** 3611,3616 ****
--- 3611,3623 ----
return x;
}
+ #ifdef NO_FUNCTION_CSE
+ case CALL:
+ if (CONSTANT_P (XEXP (XEXP (x, 0), 0)))
+ return x;
+ break;
+ #endif
+
case ASM_OPERANDS:
for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
validate_change (insn, &ASM_OPERANDS_INPUT (x, i),