ifcvt.c (noce_try_store_flag, [...]): Insert new code before JUMP, not EARLIEST.

* ifcvt.c (noce_try_store_flag, noce_try_store_flag_constants,
        noce_try_store_flag_inc, noce_try_store_flag_mask, noce_try_cmove,
        noce_try_cmove_arith, noce_try_minmax, noce_try_abs): Insert new
        code before JUMP, not EARLIEST.

From-SVN: r53123
This commit is contained in:
Richard Henderson 2002-05-03 13:34:31 -07:00
parent ba2e86d69d
commit b548220837
3 changed files with 51 additions and 12 deletions

View file

@ -1,3 +1,11 @@
2002-05-03 Richard Henderson <rth@redhat.com>
PR opt/6534
* ifcvt.c (noce_try_store_flag, noce_try_store_flag_constants,
noce_try_store_flag_inc, noce_try_store_flag_mask, noce_try_cmove,
noce_try_cmove_arith, noce_try_minmax, noce_try_abs): Insert new
code before JUMP, not EARLIEST.
2002-05-03 Joseph S. Myers <jsm28@cam.ac.uk>
* c-format.c (check_format_info_main): Don't check for presence of
@ -147,10 +155,10 @@ Thu May 2 19:50:04 CEST 2002 Jan Hubicka <jh@suse.cz>
2002-05-02 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/altivec-8.c: New.
* gcc.dg/altivec-8.c: New.
* config/rs6000/rs6000.c (rs6000_legitimate_address): Disallow
PRE_INC and PRE_DEC for altivec modes.
* config/rs6000/rs6000.c (rs6000_legitimate_address): Disallow
PRE_INC and PRE_DEC for altivec modes.
2002-05-01 Bruce Korb <bkorb@gnu.org>

View file

@ -620,7 +620,7 @@ noce_try_store_flag (if_info)
seq = get_insns ();
end_sequence ();
emit_insns_before (seq, if_info->cond_earliest);
emit_insns_before (seq, if_info->jump);
return TRUE;
}
@ -755,7 +755,7 @@ noce_try_store_flag_constants (if_info)
if (seq_contains_jump (seq))
return FALSE;
emit_insns_before (seq, if_info->cond_earliest);
emit_insns_before (seq, if_info->jump);
return TRUE;
}
@ -815,7 +815,7 @@ noce_try_store_flag_inc (if_info)
if (seq_contains_jump (seq))
return FALSE;
emit_insns_before (seq, if_info->cond_earliest);
emit_insns_before (seq, if_info->jump);
return TRUE;
}
@ -867,7 +867,7 @@ noce_try_store_flag_mask (if_info)
if (seq_contains_jump (seq))
return FALSE;
emit_insns_before (seq, if_info->cond_earliest);
emit_insns_before (seq, if_info->jump);
return TRUE;
}
@ -962,7 +962,7 @@ noce_try_cmove (if_info)
seq = get_insns ();
end_sequence ();
emit_insns_before (seq, if_info->cond_earliest);
emit_insns_before (seq, if_info->jump);
return TRUE;
}
else
@ -1124,7 +1124,7 @@ noce_try_cmove_arith (if_info)
tmp = get_insns ();
end_sequence ();
emit_insns_before (tmp, if_info->cond_earliest);
emit_insns_before (tmp, if_info->jump);
return TRUE;
end_seq_and_fail:
@ -1376,7 +1376,7 @@ noce_try_minmax (if_info)
if (seq_contains_jump (seq))
return FALSE;
emit_insns_before (seq, earliest);
emit_insns_before (seq, if_info->jump);
if_info->cond = cond;
if_info->cond_earliest = earliest;
@ -1494,7 +1494,7 @@ noce_try_abs (if_info)
if (seq_contains_jump (seq))
return FALSE;
emit_insns_before (seq, earliest);
emit_insns_before (seq, if_info->jump);
if_info->cond = cond;
if_info->cond_earliest = earliest;
@ -1753,7 +1753,7 @@ noce_process_if_block (test_bb, then_bb, else_bb, join_bb)
if (insn_b && else_bb)
delete_insn (insn_b);
/* The new insns will have been inserted before cond_earliest. We should
/* The new insns will have been inserted just before the jump. We should
be able to remove the jump with impunity, but the condition itself may
have been modified by gcse to be shared across basic blocks. */
delete_insn (jump);

View file

@ -0,0 +1,31 @@
/* PR 6534 */
/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
insertted the code at the wrong place corrupting the i<0 test. */
void abort (void);
static char *
inttostr (long i, char buf[128])
{
unsigned long ui = i;
char *p = buf + 127;
*p = '\0';
if (i < 0)
ui = -ui;
do
*--p = '0' + ui % 10;
while ((ui /= 10) != 0);
if (i < 0)
*--p = '-';
return p;
}
int
main ()
{
char buf[128], *p;
p = inttostr (-1, buf);
if (*p != '-')
abort ();
return 0;
}