+++ /dev/null
---- a/gcc/tree-ssa-tail-merge.c
-+++ b/gcc/tree-ssa-tail-merge.c
-@@ -1033,7 +1033,7 @@ set_cluster (basic_block bb1, basic_bloc
- gimple_bb (s2) are members of SAME_SUCC. */
-
- static bool
--gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
-+gimple_equal_p (same_succ same_succ, gimple s1, gimple s2, bool *gvn_used)
- {
- unsigned int i;
- tree lhs1, lhs2;
-@@ -1069,7 +1069,10 @@ gimple_equal_p (same_succ same_succ, gim
- if (operand_equal_p (t1, t2, 0))
- continue;
- if (gvn_uses_equal (t1, t2))
-- continue;
-+ {
-+ *gvn_used = true;
-+ continue;
-+ }
- equal = false;
- break;
- }
-@@ -1083,12 +1086,16 @@ gimple_equal_p (same_succ same_succ, gim
- if (lhs1 == NULL_TREE || lhs2 == NULL_TREE)
- return false;
- if (TREE_CODE (lhs1) == SSA_NAME && TREE_CODE (lhs2) == SSA_NAME)
-- return vn_valueize (lhs1) == vn_valueize (lhs2);
-+ {
-+ *gvn_used = true;
-+ return vn_valueize (lhs1) == vn_valueize (lhs2);
-+ }
- return operand_equal_p (lhs1, lhs2, 0);
-
- case GIMPLE_ASSIGN:
- lhs1 = gimple_get_lhs (s1);
- lhs2 = gimple_get_lhs (s2);
-+ *gvn_used = true;
- return (TREE_CODE (lhs1) == SSA_NAME
- && TREE_CODE (lhs2) == SSA_NAME
- && vn_valueize (lhs1) == vn_valueize (lhs2));
-@@ -1096,15 +1103,23 @@ gimple_equal_p (same_succ same_succ, gim
- case GIMPLE_COND:
- t1 = gimple_cond_lhs (s1);
- t2 = gimple_cond_lhs (s2);
-- if (!operand_equal_p (t1, t2, 0)
-- && !gvn_uses_equal (t1, t2))
-- return false;
-+ if (!operand_equal_p (t1, t2, 0))
-+ {
-+ if (gvn_uses_equal (t1, t2))
-+ *gvn_used = true;
-+ else
-+ return false;
-+ }
-
- t1 = gimple_cond_rhs (s1);
- t2 = gimple_cond_rhs (s2);
-- if (!operand_equal_p (t1, t2, 0)
-- && !gvn_uses_equal (t1, t2))
-- return false;
-+ if (!operand_equal_p (t1, t2, 0))
-+ {
-+ if (gvn_uses_equal (t1, t2))
-+ *gvn_used = true;
-+ else
-+ return false;
-+ }
-
- code1 = gimple_expr_code (s1);
- code2 = gimple_expr_code (s2);
-@@ -1126,18 +1141,25 @@ gimple_equal_p (same_succ same_succ, gim
- /* Let GSI skip backwards over local defs. */
-
- static void
--gsi_advance_bw_nondebug_nonlocal (gimple_stmt_iterator *gsi)
-+gsi_advance_bw_nondebug_nonlocal (gimple_stmt_iterator *gsi, tree *vuse)
- {
- gimple stmt;
-+ tree lvuse;
-
- while (true)
- {
- if (gsi_end_p (*gsi))
- return;
- stmt = gsi_stmt (*gsi);
-+
-+ lvuse = gimple_vuse (stmt);
-+ if (lvuse != NULL_TREE)
-+ *vuse = lvuse;
-+
- if (!(is_gimple_assign (stmt) && local_def (gimple_get_lhs (stmt))
- && !gimple_has_side_effects (stmt)))
- return;
-+
- gsi_prev_nondebug (gsi);
- }
- }
-@@ -1146,28 +1168,34 @@ gsi_advance_bw_nondebug_nonlocal (gimple
- clusters them. */
-
- static void
--find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2)
-+find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2,
-+ bool gvn_used)
- {
- gimple_stmt_iterator gsi1 = gsi_last_nondebug_bb (bb1);
- gimple_stmt_iterator gsi2 = gsi_last_nondebug_bb (bb2);
-+ tree vuse1 = NULL_TREE, vuse2 = NULL_TREE;
-
-- gsi_advance_bw_nondebug_nonlocal (&gsi1);
-- gsi_advance_bw_nondebug_nonlocal (&gsi2);
-+ gsi_advance_bw_nondebug_nonlocal (&gsi1, &vuse1);
-+ gsi_advance_bw_nondebug_nonlocal (&gsi2, &vuse2);
-
- while (!gsi_end_p (gsi1) && !gsi_end_p (gsi2))
- {
-- if (!gimple_equal_p (same_succ, gsi_stmt (gsi1), gsi_stmt (gsi2)))
-+ if (!gimple_equal_p (same_succ, gsi_stmt (gsi1), gsi_stmt (gsi2),
-+ &gvn_used))
- return;
-
- gsi_prev_nondebug (&gsi1);
- gsi_prev_nondebug (&gsi2);
-- gsi_advance_bw_nondebug_nonlocal (&gsi1);
-- gsi_advance_bw_nondebug_nonlocal (&gsi2);
-+ gsi_advance_bw_nondebug_nonlocal (&gsi1, &vuse1);
-+ gsi_advance_bw_nondebug_nonlocal (&gsi2, &vuse2);
- }
-
- if (!(gsi_end_p (gsi1) && gsi_end_p (gsi2)))
- return;
-
-+ if (gvn_used && vuse1 != vuse2)
-+ return;
-+
- if (dump_file)
- fprintf (dump_file, "find_duplicates: <bb %d> duplicate of <bb %d>\n",
- bb1->index, bb2->index);
-@@ -1179,7 +1207,7 @@ find_duplicate (same_succ same_succ, bas
- E2 are equal. */
-
- static bool
--same_phi_alternatives_1 (basic_block dest, edge e1, edge e2)
-+same_phi_alternatives_1 (basic_block dest, edge e1, edge e2, bool *gvn_used)
- {
- int n1 = e1->dest_idx, n2 = e2->dest_idx;
- gimple_stmt_iterator gsi;
-@@ -1197,7 +1225,10 @@ same_phi_alternatives_1 (basic_block des
- if (operand_equal_for_phi_arg_p (val1, val2))
- continue;
- if (gvn_uses_equal (val1, val2))
-- continue;
-+ {
-+ *gvn_used = true;
-+ continue;
-+ }
-
- return false;
- }
-@@ -1209,7 +1240,8 @@ same_phi_alternatives_1 (basic_block des
- phi alternatives for BB1 and BB2 are equal. */
-
- static bool
--same_phi_alternatives (same_succ same_succ, basic_block bb1, basic_block bb2)
-+same_phi_alternatives (same_succ same_succ, basic_block bb1, basic_block bb2,
-+ bool *gvn_used)
- {
- unsigned int s;
- bitmap_iterator bs;
-@@ -1227,7 +1259,7 @@ same_phi_alternatives (same_succ same_su
-
- /* For all phis in bb, the phi alternatives for e1 and e2 need to have
- the same value. */
-- if (!same_phi_alternatives_1 (succ, e1, e2))
-+ if (!same_phi_alternatives_1 (succ, e1, e2, gvn_used))
- return false;
- }
-
-@@ -1301,6 +1333,7 @@ find_clusters_1 (same_succ same_succ)
- bitmap_iterator bi, bj;
- int nr_comparisons;
- int max_comparisons = PARAM_VALUE (PARAM_MAX_TAIL_MERGE_COMPARISONS);
-+ bool gvn_used;
-
- EXECUTE_IF_SET_IN_BITMAP (same_succ->bbs, 0, i, bi)
- {
-@@ -1333,10 +1366,11 @@ find_clusters_1 (same_succ same_succ)
- if (!deps_ok_for_redirect (bb1, bb2))
- continue;
-
-- if (!(same_phi_alternatives (same_succ, bb1, bb2)))
-+ gvn_used = false;
-+ if (!(same_phi_alternatives (same_succ, bb1, bb2, &gvn_used)))
- continue;
-
-- find_duplicate (same_succ, bb1, bb2);
-+ find_duplicate (same_succ, bb1, bb2, gvn_used);
- }
- }
- }
---- /dev/null
-+++ b/testsuite/gcc.dg/pr52734.c
-@@ -0,0 +1,35 @@
-+/* { dg-do run } */
-+/* { dg-options "-O2" } */
-+
-+int bbb = 0;
-+
-+int __attribute__((noinline,noclone)) aaa(void)
-+{
-+ ++bbb;
-+ return 0;
-+}
-+
-+int __attribute__((noinline,noclone)) ccc(void)
-+{
-+ int ddd;
-+ /* bbb == 0 */
-+ if (aaa())
-+ return bbb;
-+
-+ /* bbb == 1 */
-+ ddd = bbb;
-+ /* bbb == ddd == 1 */
-+ if (aaa ())
-+ return 0;
-+ /* bbb == 2, ddd == 1 */
-+
-+ return ddd;
-+}
-+
-+int main(void)
-+{
-+ if (ccc() != 1)
-+ __builtin_abort();
-+ return 0;
-+}
-+
+++ /dev/null
-There is one usage in boehm-gc/os_dep.c, but it is only used if
-SUNOS5SIGS is defined, which it is only if one of SUNOS5, DRSNX, HPUX, or
-FREEBSD is defined, which are all not using Linux-based glibc ports.
-
-Likewise, gcc/ada/init.c has a struct __siginfo occurence, but only for
-__FreeBSD__.
-
-config/rs6000/linux-unwind.h uses ``char siginfo[128]'', and
-config/s390/linux-unwind.h also uses a constant.
-
-I tested the following patch for sh-linux-gnu. This only covers one
-configuration, but the change is pretty mechanic anyway and every place
-that used to refer to struct siginfo already must have had <signal.h> in
-its include path, which is the same file that declares siginfo_t.
-
-OK to commit? This should probably also go into any active release
-branches, to keep them buildable once this glibc change ripples through?
-
-libgcc/
- * config/alpha/linux-unwind.h (alpha_fallback_frame_state): Use
- siginfo_t instead of struct siginfo.
- * config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise.
- * config/i386/linux-unwind.h (x86_fallback_frame_state): Likewise.
- * config/ia64/linux-unwind.h (ia64_fallback_frame_state)
- (ia64_handle_unwabi): Likewise.
- * config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise.
- * config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise.
- * config/sh/linux-unwind.h (shmedia_fallback_frame_state)
- (sh_fallback_frame_state): Likewise.
- * config/tilepro/linux-unwind.h (tile_fallback_frame_state): Likewise.
- * config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Likewise.
----
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/alpha/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/alpha/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/alpha/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/alpha/linux-unwind.h 2012-09-13 14:07:22.307413027 +0200
-@@ -49,7 +49,7 @@
- else if (pc[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */
- {
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/bfin/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/bfin/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/bfin/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/bfin/linux-unwind.h 2012-09-13 14:07:36.343413388 +0200
-@@ -48,10 +48,10 @@
- {
- struct rt_sigframe {
- int sig;
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
- char retcode[8];
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
-
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/i386/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/i386/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/i386/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/i386/linux-unwind.h 2012-09-13 14:07:49.147413712 +0200
-@@ -139,9 +139,9 @@
- {
- struct rt_sigframe {
- int sig;
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/mips/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/mips/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/mips/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/mips/linux-unwind.h 2012-09-13 14:08:43.007415091 +0200
-@@ -75,7 +75,7 @@
- struct rt_sigframe {
- u_int32_t ass[4]; /* Argument save space for o32. */
- u_int32_t trampoline[2];
-- struct siginfo info;
-+ siginfo_t info;
- _sig_ucontext_t uc;
- } *rt_ = context->cfa;
- sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/pa/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/pa/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/pa/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/pa/linux-unwind.h 2012-09-13 14:08:54.335415383 +0200
-@@ -63,7 +63,7 @@
- int i;
- struct sigcontext *sc;
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *frame;
-
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/sh/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/sh/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/sh/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/sh/linux-unwind.h 2012-09-13 14:09:12.383415847 +0200
-@@ -80,9 +80,9 @@
- && (*(unsigned long *) (pc+11) == 0x6ff0fff0))
- {
- struct rt_sigframe {
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-@@ -179,7 +179,7 @@
- && (*(unsigned short *) (pc+14) == 0x00ad))))
- {
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/tilepro/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/tilepro/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/tilepro/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/tilepro/linux-unwind.h 2012-09-13 14:09:28.907416268 +0200
-@@ -61,7 +61,7 @@
-
- struct rt_sigframe {
- unsigned char save_area[C_ABI_SAVE_AREA_SIZE];
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_;
-
-diff -urN gcc-linaro-4.7-2012.04/libgcc/config/xtensa/linux-unwind.h gcc-linaro-4.7-2012.04.new/libgcc/config/xtensa/linux-unwind.h
---- gcc-linaro-4.7-2012.04/libgcc/config/xtensa/linux-unwind.h 2012-04-10 11:54:47.000000000 +0200
-+++ gcc-linaro-4.7-2012.04.new/libgcc/config/xtensa/linux-unwind.h 2012-09-13 14:09:41.399416587 +0200
-@@ -62,7 +62,7 @@
- struct sigcontext *sc;
-
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_;
-