I am testing reversal of r246809 which was bogus.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

Richard.

2017-05-02  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/80591
        Revert
        2017-04-10  Richard Biener  <rguent...@suse.de>

        * tree-ssa-structalias.c (find_func_aliases): Properly handle
        asm inputs.

        * gcc.dg/torture/pr80591.c: New testcase.

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 247368)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -4944,14 +4944,14 @@ find_func_aliases (struct function *fn,
            make_escape_constraint (build_fold_addr_expr (op));
 
          /* The asm may read global memory, so outputs may point to
-            any global or escaped memory.  */
+            any global memory.  */
          if (op)
            {
              auto_vec<ce_s, 2> lhsc;
              struct constraint_expr rhsc, *lhsp;
              unsigned j;
              get_constraint_for (op, &lhsc);
-             rhsc.var = escaped_id;
+             rhsc.var = nonlocal_id;
              rhsc.offset = 0;
              rhsc.type = SCALAR;
              FOR_EACH_VEC_ELT (lhsc, j, lhsp)
Index: gcc/testsuite/gcc.dg/torture/pr80591.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr80591.c      (nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr80591.c      (working copy)
@@ -0,0 +1,20 @@
+/* PR tree-optimization/80591 */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } "-flto" } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
+
+static inline __attribute__((always_inline)) int *
+foo (void)
+{
+  __UINTPTR_TYPE__ sp;
+  asm ("" : "=r" (sp));
+  return (int *) sp;
+}
+
+void
+bar (void)
+{
+  foo ()[0] += 26;
+}
+
+/* { dg-final { scan-tree-dump "\\+ 26;" "optimized" } } */

Reply via email to