tree-vrp.c (infer_value_range): Ignore asm statements when looking for memory accesses for...

./:	* tree-vrp.c (infer_value_range): Ignore asm statements when
	looking for memory accesses for -fdelete-null-pointer-checks.
testsuite/:
	* gcc.target/i386/20080723-1.c: New test.

From-SVN: r138107
This commit is contained in:
Ian Lance Taylor 2008-07-24 04:51:12 +00:00 committed by Ian Lance Taylor
parent e816b6b586
commit 11522353fe
4 changed files with 61 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-07-23 Ian Lance Taylor <iant@google.com>
* tree-vrp.c (infer_value_range): Ignore asm statements when
looking for memory accesses for -fdelete-null-pointer-checks.
2008-07-24 Ben Elliston <bje@au.ibm.com>
* config/spu/spu-c.c (__vector_keyword): New variable.

View File

@ -1,3 +1,7 @@
2008-07-23 Ian Lance Taylor <iant@google.com>
* gcc.target/i386/20080723-1.c: New test.
2008-07-24 Ben Elliston <bje@au.ibm.com>
* gcc.target/spu/vector.c: New test.

View File

@ -0,0 +1,49 @@
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort (void);
extern void exit (int);
static inline __attribute__((always_inline))
void
prefetch (void *x)
{
asm volatile("prefetcht0 %0" : : "m" (*(unsigned long *)x));
}
struct hlist_head
{
struct hlist_node *first;
};
struct hlist_node
{
struct hlist_node *next;
unsigned long i_ino;
};
struct hlist_node * find_inode_fast(struct hlist_head *head, unsigned long ino)
{
struct hlist_node *node;
for (node = head->first;
node && (prefetch (node->next), 1);
node = node->next)
{
if (node->i_ino == ino)
break;
}
return node ? node : 0;
}
struct hlist_node g2;
struct hlist_node g1 = { &g2 };
struct hlist_head h = { &g1 };
int
main()
{
if (find_inode_fast (&h, 1) != 0)
abort ();
exit (0);
}

View File

@ -3456,7 +3456,9 @@ infer_value_range (tree stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
/* We can only assume that a pointer dereference will yield
non-NULL if -fdelete-null-pointer-checks is enabled. */
if (flag_delete_null_pointer_checks && POINTER_TYPE_P (TREE_TYPE (op)))
if (flag_delete_null_pointer_checks
&& POINTER_TYPE_P (TREE_TYPE (op))
&& TREE_CODE (stmt) != ASM_EXPR)
{
unsigned num_uses, num_loads, num_stores;