public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Filip Kastl <pheeck@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/pheeck/heads/sccp)] fixed bug when scc references same var multiple times Date: Mon, 5 Sep 2022 09:27:48 +0000 (GMT) [thread overview] Message-ID: <20220905092748.E3C5B385701F@sourceware.org> (raw) https://gcc.gnu.org/g:e92422ecae491dc4655d206e96a6b0536e1eaccf commit e92422ecae491dc4655d206e96a6b0536e1eaccf Author: Filip Kastl <filip.kastl@gmail.com> Date: Mon Sep 5 11:27:39 2022 +0200 fixed bug when scc references same var multiple times Diff: --- gcc/sccp.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/sccp.cc b/gcc/sccp.cc index 4dcedc293fd..1ac4474c019 100644 --- a/gcc/sccp.cc +++ b/gcc/sccp.cc @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include <iostream> #include "gimple-pretty-print.h" #include "vec.h" +#include "hash-set.h" #include "libiberty.h" #include "print-tree.h" @@ -373,7 +374,7 @@ static void process_scc (vec<gphi *> scc) { vec<gphi *> inner = vNULL; - vec<tree> outer_ops = vNULL; + hash_set<tree> outer_ops; for (gphi *phi : scc) { @@ -400,7 +401,7 @@ process_scc (vec<gphi *> scc) if (!op_in_scc) { - outer_ops.safe_push (op); + outer_ops.add (op); is_inner = false; } } @@ -412,9 +413,19 @@ process_scc (vec<gphi *> scc) } // TODO if == 0 -> unreachable? - if (outer_ops.length () == 1) - replace_scc_by_value (scc, outer_ops.pop()); - else if (outer_ops.length () > 1) + if (outer_ops.elements () == 1) + { + /* Get the only operand in outer_ops. */ + tree outer_op; + for (tree foo : outer_ops) + { + outer_op = foo; + break; + } + + replace_scc_by_value (scc, outer_op); + } + else if (outer_ops.elements () > 1) { remove_redundant_phis (inner); }
next reply other threads:[~2022-09-05 9:27 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-05 9:27 Filip Kastl [this message] 2023-02-15 10:14 Filip Kastl
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220905092748.E3C5B385701F@sourceware.org \ --to=pheeck@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).