Commit b77302be by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/19551 (pure (complex types) function call removed as dead…

re PR middle-end/19551 (pure (complex types) function call removed as dead (LAPACK routine claic1.f bug))

	* flow.c (propagate_one_insn): Formatting.

	PR middle-end/19551
	* flow.c (libcall_dead_p): Be more conservative if unsure.
	If there are any instructions between insn and call, see if they are
	all dead before saying the libcall is dead.

	* gcc.c-torture/execute/20050121-1.c: New test.
	* gcc.dg/20050121-2.c: New test.

From-SVN: r94145
parent 11c56af5
2005-01-24 Jakub Jelinek <jakub@redhat.com>
* flow.c (propagate_one_insn): Formatting.
PR middle-end/19551
* flow.c (libcall_dead_p): Be more conservative if unsure.
If there are any instructions between insn and call, see if they are
all dead before saying the libcall is dead.
2005-01-24 Uros Bizjak <uros@kss-loka.si>
* config/i386/i386.md (*extendsfdf2_sse): Use "nonimmediate_operand"
......
......@@ -1581,7 +1581,7 @@ propagate_one_insn (struct propagate_block_info *pbi, rtx insn)
pbi->cc0_live = 0;
if (libcall_is_dead)
prev = propagate_block_delete_libcall ( insn, note);
prev = propagate_block_delete_libcall (insn, note);
else
{
......@@ -2284,7 +2284,7 @@ libcall_dead_p (struct propagate_block_info *pbi, rtx note, rtx insn)
{
rtx r = SET_SRC (x);
if (REG_P (r))
if (REG_P (r) || GET_CODE (r) == SUBREG)
{
rtx call = XEXP (note, 0);
rtx call_pat;
......@@ -2318,10 +2318,20 @@ libcall_dead_p (struct propagate_block_info *pbi, rtx note, rtx insn)
call_pat = XVECEXP (call_pat, 0, i);
}
return insn_dead_p (pbi, call_pat, 1, REG_NOTES (call));
if (! insn_dead_p (pbi, call_pat, 1, REG_NOTES (call)))
return 0;
while ((insn = PREV_INSN (insn)) != call)
{
if (! INSN_P (insn))
continue;
if (! insn_dead_p (pbi, PATTERN (insn), 0, REG_NOTES (insn)))
return 0;
}
return 1;
}
}
return 1;
return 0;
}
/* 1 if register REGNO was alive at a place where `setjmp' was called
......
2005-01-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/19551
* gcc.c-torture/execute/20050121-1.c: New test.
* gcc.dg/20050121-2.c: New test.
2004-01-23 Steven G. Kargl <kargls@comcast.net>
Paul Brook <paul@codesourcery.com>
......
/* PR middle-end/19551 */
extern void abort ();
#define T(type, name) \
__attribute__((pure)) _Complex type \
foo_##name (int x) \
{ \
_Complex type r; \
__real r = x + 1; \
__imag r = x - 1; \
return r; \
} \
\
void \
bar_##name (type *x) \
{ \
*x = __real foo_##name (5); \
} \
\
void \
baz_##name (type *x) \
{ \
*x = __imag foo_##name (5); \
}
typedef long double ldouble_t;
typedef long long llong;
T (float, float)
T (double, double)
T (long double, ldouble_t)
T (char, char)
T (short, short)
T (int, int)
T (long, long)
T (long long, llong)
#undef T
int
main (void)
{
#define T(type, name) \
{ \
type var = 0; \
bar_##name (&var); \
if (var != 6) \
abort (); \
var = 0; \
baz_##name (&var); \
if (var != 4) \
abort (); \
}
T (float, float)
T (double, double)
T (long double, ldouble_t)
T (char, char)
T (short, short)
T (int, int)
T (long, long)
T (long long, llong)
return 0;
}
/* PR middle-end/19551 */
/* { dg-options "-O2" } */
/* { dg-do link } */
extern void abort ();
#define T(type, name) \
extern __attribute__((pure)) _Complex type \
foo_c##name (int x); \
\
void \
bar_c##name (type *x) \
{ \
type f = __real foo_c##name (5); \
if (0) *x = f; \
} \
\
void \
baz_c##name (type *x) \
{ \
type f = __imag foo_c##name (5); \
if (0) *x = f; \
} \
\
extern __attribute__((pure)) type \
foo_##name (int x); \
\
void \
bar_##name (type *x) \
{ \
type f = foo_##name (5); \
if (0) *x = f; \
}
typedef long double ldouble_t;
typedef long long llong;
T (float, float)
T (double, double)
T (long double, ldouble_t)
T (char, char)
T (short, short)
T (int, int)
T (long, long)
T (long long, llong)
#undef T
int
main (void)
{
#define T(type, name) \
{ \
type var = 0; \
bar_c##name (&var); \
baz_c##name (&var); \
bar_##name (&var); \
}
T (float, float)
T (double, double)
T (long double, ldouble_t)
T (char, char)
T (short, short)
T (int, int)
T (long, long)
T (long long, llong)
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