new file mode 100644
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fmerge-all-constants" } */
+
+char *p;
+
+char * __attribute__((noipa))
+foo () { return p+1; }
+
+volatile int z;
+
+int main()
+{
+ /* ESCAPED = CONST_POOL */
+ p = "Hello";
+ /* PT = ESCAPED */
+ char *x = foo ();
+ char *y;
+ /* y PT = CONST_POOL */
+ if (z)
+ y = "Baz";
+ else
+ y = "Hello" + 1;
+ if (y != x)
+ __builtin_abort ();
+ return 0;
+}
@@ -501,7 +501,8 @@ ptrs_compare_unequal (tree ptr1, tree ptr2)
|| pi2->pt.vars_contains_interposable)
return false;
if ((!pi1->pt.null || !pi2->pt.null)
- && (!pi1->pt.const_pool || !pi2->pt.const_pool))
+ && (!pt_solution_includes_const_pool (&pi1->pt)
+ || !pt_solution_includes_const_pool (&pi2->pt)))
return !pt_solutions_intersect (&pi1->pt, &pi2->pt);
}
}
@@ -178,6 +178,7 @@ extern bool pt_solution_empty_p (const pt_solution *);
extern bool pt_solution_singleton_or_null_p (struct pt_solution *, unsigned *);
extern bool pt_solution_includes_global (struct pt_solution *, bool);
extern bool pt_solution_includes (struct pt_solution *, const_tree);
+extern bool pt_solution_includes_const_pool (struct pt_solution *);
extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
extern void pt_solution_reset (struct pt_solution *);
extern void pt_solution_set (struct pt_solution *, bitmap, bool);
@@ -7080,6 +7080,17 @@ pt_solution_includes (struct pt_solution *pt, const_tree decl)
return res;
}
+/* Return true if the points-to solution *PT contains a reference to a
+ constant pool entry. */
+
+bool
+pt_solution_includes_const_pool (struct pt_solution *pt)
+{
+ return (pt->const_pool
+ || (pt->escaped && (!cfun || cfun->gimple_df->escaped.const_pool))
+ || (pt->ipa_escaped && ipa_escaped_pt.const_pool));
+}
+
/* Return true if both points-to solutions PT1 and PT2 have a non-empty
intersection. */