gcse.c (store_killed_in_insn): Consider pure calls as potential store killers in addition to normal calls.
* gcse.c (store_killed_in_insn): Consider pure calls as potential store killers in addition to normal calls. * gcc.c-torture/execute/20011024-1.c: New test. From-SVN: r47675
This commit is contained in:
parent
7254c5fa73
commit
1218665b70
@ -1,3 +1,8 @@
|
||||
2001-12-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcse.c (store_killed_in_insn): Consider pure calls
|
||||
as potential store killers in addition to normal calls.
|
||||
|
||||
2001-12-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* expr.c (expand_expr): When checking promoted value, use
|
||||
|
15
gcc/gcse.c
15
gcc/gcse.c
@ -6498,8 +6498,21 @@ store_killed_in_insn (x, insn)
|
||||
|
||||
if (GET_CODE (insn) == CALL_INSN)
|
||||
{
|
||||
/* A normal or pure call might read from pattern,
|
||||
but a const call will not. */
|
||||
if (CONST_OR_PURE_CALL_P (insn))
|
||||
return 0;
|
||||
{
|
||||
rtx link;
|
||||
|
||||
for (link = CALL_INSN_FUNCTION_USAGE (insn);
|
||||
link;
|
||||
link = XEXP (link, 1))
|
||||
if (GET_CODE (XEXP (link, 0)) == USE
|
||||
&& GET_CODE (XEXP (XEXP (link, 0), 0)) == MEM
|
||||
&& GET_CODE (XEXP (XEXP (XEXP (link, 0), 0), 0)) == SCRATCH)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
* g++.dg/other/anon-union.C: New test.
|
||||
|
||||
* gcc.c-torture/execute/20011024-1.c: New test.
|
||||
|
||||
2001-12-04 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gcc.c-torture/execute/20000722-1.x,
|
||||
|
22
gcc/testsuite/gcc.c-torture/execute/20011024-1.c
Normal file
22
gcc/testsuite/gcc.c-torture/execute/20011024-1.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* Test whether store motion recognizes pure functions as potentially reading
|
||||
any memory. */
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
extern void *memcpy (void *dest, const void *src, size_t n);
|
||||
extern size_t strlen (const char *s);
|
||||
extern int strcmp (const char *s1, const char *s2) __attribute__((pure));
|
||||
|
||||
char buf[50];
|
||||
|
||||
static void foo (void)
|
||||
{
|
||||
if (memcpy (buf, "abc", 4) != buf) abort ();
|
||||
if (strcmp (buf, "abc")) abort ();
|
||||
memcpy (buf, "abcdefgh", strlen ("abcdefgh") + 1);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
foo ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user