This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make one extra BB to prevent PHI argument clash (PR, gcov-profile/78582)
- From: Martin Liška <mliska at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 29 Nov 2016 11:46:08 +0100
- Subject: [PATCH] Make one extra BB to prevent PHI argument clash (PR, gcov-profile/78582)
- Authentication-results: sourceware.org; auth=none
Following ICE has been reduced from bash, where a new CFG does not properly
fill a newly added PHI argument. Problem is solved by adding one extra BB that
precedes the original BB with the PHI. Doing so, we do not add a new PHI argument.
Tests have been running.
Ready to be installed after it finishes?
Thanks,
Martin
>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
diff --git a/gcc/testsuite/gcc.dg/pr78582.c b/gcc/testsuite/gcc.dg/pr78582.c
new file mode 100644
index 0000000..3084e3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78582.c
@@ -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;
+}
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index a4f9d11..77fb86e 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -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