Commit 039baf9e by Eric Botcazou Committed by Eric Botcazou

re PR rtl-optimization/8988 (gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates…

re PR rtl-optimization/8988 (gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults)

	PR optimization/8988
	* loop.c (maybe_eliminate_biv): Kill REG_EQUAL notes mentioning
	the biv when eliminating.

From-SVN: r60334
parent ee8acf89
2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/8988
* loop.c (maybe_eliminate_biv): Kill REG_EQUAL notes mentioning
the biv when eliminating.
2002-12-19 Devang Patel <dpatel@apple.com> 2002-12-19 Devang Patel <dpatel@apple.com>
* gcc.c (struct default_compiler): Recognizes input file name with * gcc.c (struct default_compiler): Recognizes input file name with
.CPP extension as C++ source files .CPP extension as C++ source files
......
...@@ -8612,11 +8612,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count) ...@@ -8612,11 +8612,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
enum rtx_code code = GET_CODE (p); enum rtx_code code = GET_CODE (p);
basic_block where_bb = 0; basic_block where_bb = 0;
rtx where_insn = threshold >= insn_count ? 0 : p; rtx where_insn = threshold >= insn_count ? 0 : p;
rtx note;
/* If this is a libcall that sets a giv, skip ahead to its end. */ /* If this is a libcall that sets a giv, skip ahead to its end. */
if (GET_RTX_CLASS (code) == 'i') if (GET_RTX_CLASS (code) == 'i')
{ {
rtx note = find_reg_note (p, REG_LIBCALL, NULL_RTX); note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
if (note) if (note)
{ {
...@@ -8634,6 +8635,8 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count) ...@@ -8634,6 +8635,8 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
} }
} }
} }
/* Closely examine the insn if the biv is mentioned. */
if ((code == INSN || code == JUMP_INSN || code == CALL_INSN) if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
&& reg_mentioned_p (reg, PATTERN (p)) && reg_mentioned_p (reg, PATTERN (p))
&& ! maybe_eliminate_biv_1 (loop, PATTERN (p), p, bl, && ! maybe_eliminate_biv_1 (loop, PATTERN (p), p, bl,
...@@ -8645,6 +8648,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count) ...@@ -8645,6 +8648,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
bl->regno, INSN_UID (p)); bl->regno, INSN_UID (p));
break; break;
} }
/* If we are eliminating, kill REG_EQUAL notes mentioning the biv. */
if (eliminate_p
&& (note = find_reg_note (p, REG_EQUAL, NULL_RTX)) != NULL_RTX
&& reg_mentioned_p (reg, XEXP (note, 0)))
remove_note (p, note);
} }
if (p == loop->end) if (p == loop->end)
......
2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr> 2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/execute/20021219-1.c: New test.
2002-12-19 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/i386-pic-1.c: New test. * gcc.dg/i386-pic-1.c: New test.
2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
......
/* PR optimization/8988 */
/* Contributed by Kevin Easton */
void foo(char *p1, char **p2)
{}
int main(void)
{
char str[] = "foo { xx }";
char *ptr = str + 5;
foo(ptr, &ptr);
while (*ptr && (*ptr == 13 || *ptr == 32))
ptr++;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment