From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] vect: Init inside_cost in vect_model_reduction_cost
Date: Thu, 25 Mar 2021 14:04:24 +0800 [thread overview]
Message-ID: <73b8262f-ab6f-b2f4-2011-86582f217890@linux.ibm.com> (raw)
Hi,
I happened to find this possible use of uninitialized inside_cost during
checking the cost for reduction. Before r11-6587, all the if/else if/else
arms will assign values to inside_cost, so it was fine. But from r11-6587
the else path won't assign any more, it leads the inside_cost possibly
uninitialized for later use. Note that it won't have any functionality
issues, just could show one unreasonable cost in dump file.
This is a trivial fix and I guess it can be counted as obvious, but
I'm not sure if it's ok in stage 4. So is it ok for trunk?
BR,
Kewen
-----
gcc/ChangeLog:
* tree-vect-loop.c (vect_model_reduction_cost): Init inside_cost.
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 3e973e774af..38d96fc1634 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4465,7 +4465,7 @@ vect_model_reduction_cost (loop_vec_info loop_vinfo,
vect_reduction_type reduction_type,
int ncopies, stmt_vector_for_cost *cost_vec)
{
- int prologue_cost = 0, epilogue_cost = 0, inside_cost;
+ int prologue_cost = 0, epilogue_cost = 0, inside_cost = 0;
enum tree_code code;
optab optab;
tree vectype;
next reply other threads:[~2021-03-25 6:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 6:04 Kewen.Lin [this message]
2021-03-25 6:16 ` Jeff Law
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=73b8262f-ab6f-b2f4-2011-86582f217890@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=gcc-patches@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: link
Be 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).