./:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jul 2008 04:51:12 +0000 (04:51 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jul 2008 04:51:12 +0000 (04:51 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138107 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/20080723-1.c [new file with mode: 0644]
gcc/tree-vrp.c

index 82c7e61..b032c85 100644 (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.
index 5be864f..f4d271c 100644 (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.
diff --git a/gcc/testsuite/gcc.target/i386/20080723-1.c b/gcc/testsuite/gcc.target/i386/20080723-1.c
new file mode 100644 (file)
index 0000000..a2ed5bf
--- /dev/null
@@ -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);
+}
index 404531f..62f3147 100644 (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;