Fix MIPS SPEC95 FP 146.wave5 -fprofile-generate failure.

PR target/16325
* config/mips/mips.h (STARTING_FRAME_OFFSET): When flag_profile_value
and ! TARGET_64BIT, include REG_PARM_STACK_SPACE.
* gcc.dg/profile-generate-1.c: New.

From-SVN: r84727
This commit is contained in:
James E Wilson 2004-07-15 00:35:28 +00:00 committed by Jim Wilson
parent 27f3c2ce8d
commit b5411fea20
4 changed files with 58 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2004-07-14 James E Wilson <wilson@specifixinc.com>
PR target/16325
* config/mips/mips.h (STARTING_FRAME_OFFSET): When flag_profile_value
and ! TARGET_64BIT, include REG_PARM_STACK_SPACE.
2004-07-15 Jakub Jelinek <jakub@redhat.com>
* expr.c (expand_assignment): Reenable bitfield += optimizations.

View File

@ -2132,9 +2132,21 @@ extern enum reg_class mips_char_to_class[256];
#define STACK_GROWS_DOWNWARD
/* The offset of the first local variable from the beginning of the frame.
See compute_frame_size for details about the frame layout. */
See compute_frame_size for details about the frame layout.
??? If flag_profile_values is true, and we are generating 32-bit code, then
we assume that we will need 16 bytes of argument space. This is because
the value profiling code may emit calls to cmpdi2 in leaf functions.
Without this hack, the local variables will start at sp+8 and the gp save
area will be at sp+16, and thus they will overlap. compute_frame_size is
OK because it uses STARTING_FRAME_OFFSET to compute cprestore_size, which
will end up as 24 instead of 8. This won't be needed if profiling code is
inserted before virtual register instantiation. */
#define STARTING_FRAME_OFFSET \
(current_function_outgoing_args_size \
((flag_profile_values && ! TARGET_64BIT \
? MAX (REG_PARM_STACK_SPACE(NULL), current_function_outgoing_args_size) \
: current_function_outgoing_args_size) \
+ (TARGET_ABICALLS && !TARGET_NEWABI \
? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0))

View File

@ -1,3 +1,8 @@
2004-07-14 James E Wilson <wilson@specifixinc.com>
PR target/16325
* gcc.dg/profile-generate-1.c: New.
2004-07-15 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20040709-1.c: New test.

View File

@ -0,0 +1,33 @@
/* Bug 16325. */
/* { dg-options "-O -fprofile-generate" } */
int *p1;
int *p2;
int *p3;
int ga = 100;
int
sub (int i, int j)
{
int k;
int l;
int m;
int n;
p1 = &k;
p2 = &l;
p3 = &m;
k = 20;
l = 30;
m = 40;
n = i / j;
return n + ga;
}
int
main(void)
{
if (sub (99, 33) != 103)
abort ();
return 0;
}