From f3de44cbf026d3295d42c36e864d469f19fc56cc Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 29 Nov 2016 11:40:04 +0100
Subject: [PATCH] Make one extra BB to prevent PHI argument clash (PR
gcov-profile/78582)
gcc/testsuite/ChangeLog:
2016-11-29 Martin Liska <mliska@suse.cz>
PR gcov-profile/78582
* gcc.dg/pr78582.c: New test.
gcc/ChangeLog:
2016-11-29 Martin Liska <mliska@suse.cz>
PR gcov-profile/78582
* tree-profile.c (gimple_gen_time_profiler): Make one extra BB
to prevent PHI argument clash.
---
gcc/testsuite/gcc.dg/pr78582.c | 18 ++++++++++++++++++
gcc/tree-profile.c | 6 +++---
2 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr78582.c
new file mode 100644
@@ -0,0 +1,18 @@
+/* PR target/78582. */
+/* { dg-options "-fprofile-generate" } */
+/* { dg-compile } */
+
+#include <setjmp.h>
+
+void reader_loop () {}
+
+int
+main (int argc, char argv, char env)
+{
+ int a;
+ sigsetjmp (0, 0);
+ argc = a = argc;
+ reader_loop ();
+
+ return 0;
+}
@@ -461,10 +461,10 @@ void
gimple_gen_time_profiler (unsigned tag, unsigned base)
{
tree type = get_gcov_type ();
- basic_block cond_bb
- = split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
-
+ basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (cfun);
+ basic_block cond_bb = split_edge (single_succ_edge (entry));
basic_block update_bb = split_edge (single_succ_edge (cond_bb));
+ split_edge (single_succ_edge (update_bb));
edge true_edge = single_succ_edge (cond_bb);
true_edge->flags = EDGE_TRUE_VALUE;
--
2.10.2