gcc/testsuite/ChangeLog:
* gcc.dg/lto/modref-3_0.c: New test.
* gcc.dg/lto/modref-3_1.c: New test.
* gcc.dg/lto/modref-4_0.c: New test.
* gcc.dg/lto/modref-4_1.c: New test.
* gcc.dg/tree-ssa/modref-5.c: New test.
--- /dev/null
+/* { dg-lto-do run } */
+/* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -fno-ipa-cp -flto} } } */
+extern void copy (int *a, int *b);
+extern void barrier ();
+extern int *ptr;
+int
+main()
+{
+ int a = 1, b = 2;
+ copy (&a,&b);
+ barrier ();
+ *ptr = 1;
+ if (!__builtin_constant_p (b == 2))
+ __builtin_abort ();
+ return 0;
+}
+/* { dg-final { scan-wpa-ipa-dump "parm 1 flags: nodirectescape" "modref" } } */
--- /dev/null
+__attribute__ ((noinline))
+void
+copy (int *a, int *b)
+{
+ *a=*b;
+}
+int p, *ptr = &p;
+__attribute__ ((noinline))
+void
+barrier ()
+{
+ asm ("":"=r"(ptr):"0"(ptr));
+}
--- /dev/null
+/* { dg-lto-do run } */
+/* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -flto} } } */
+extern void copy (int *a, int *b);
+extern void barrier ();
+extern int *ptr;
+int
+main()
+{
+ int a = 1, b = 2;
+ copy (&a,&b);
+ barrier ();
+ *ptr = 1;
+ if (!__builtin_constant_p (b == 2))
+ __builtin_abort ();
+ return 0;
+}
+/* { dg-final { scan-wpa-ipa-dump "parm 1 flags: nodirectescape" "modref" } } */
--- /dev/null
+__attribute__ ((noinline))
+void
+copy (int *a, int *b)
+{
+ *a=*b;
+}
+int p, *ptr = &p;
+__attribute__ ((noinline))
+void
+barrier ()
+{
+ asm ("":"=r"(ptr):"0"(ptr));
+}
--- /dev/null
+/* { dg-options "-O2 -fdump-tree-modref1" } */
+/* { dg-do run } */
+__attribute__ ((noinline))
+void
+copy (int *a, int *b)
+{
+ *a=*b;
+}
+int p, *ptr = &p;
+__attribute__ ((noinline))
+void
+barrier ()
+{
+ asm ("":"=r"(ptr):"0"(ptr));
+}
+int
+main()
+{
+ int a = 1, b = 2;
+ copy (&a,&b);
+ barrier ();
+ *ptr = 1;
+ if (!__builtin_constant_p (b == 2))
+ __builtin_abort ();
+ return 0;
+}
+/* { dg-final { scan-tree-dump "parm 1 flags: nodirectescape" "modref1" } } */