summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-25 17:17:46 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-25 17:17:46 +0000
commitc3aec137ea5dbcdb69b0e3d6d0eb940c702e427a (patch)
treecdaddc7c631c819d11c4bdbc84936697d50fc29c
parent6b3fc18e8f6b8342d0036513ea3c6a419b1099be (diff)
downloadgcc-c3aec137ea5dbcdb69b0e3d6d0eb940c702e427a.tar.gz
2017-07-25 Andrew Pinski <apinski@cavium.com>
* tree-ssa-uninit.c (warn_uninitialized_vars): Don't warn about memory accesses where the use is for the first operand of a BIT_INSERT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250530 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-uninit.c25
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ddf5b59339..a5c563c43e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-25 Andrew Pinski <apinski@cavium.com>
+
+ * tree-ssa-uninit.c (warn_uninitialized_vars): Don't warn about memory
+ accesses where the use is for the first operand of a BIT_INSERT.
+
2017-07-25 Jim Wilson <jim.wilson@linaro.org>
PR bootstrap/81521
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index b587599f8f8..67f0d840bf5 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -273,6 +273,11 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
&& gimple_has_location (stmt))
{
tree rhs = gimple_assign_rhs1 (stmt);
+ tree lhs = gimple_assign_lhs (stmt);
+ bool has_bit_insert = false;
+ use_operand_p luse_p;
+ imm_use_iterator liter;
+
if (TREE_NO_WARNING (rhs))
continue;
@@ -300,6 +305,26 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
ref.offset) <= 0)))
continue;
+ /* Do not warn if the access is then used for a BIT_INSERT_EXPR. */
+ if (TREE_CODE (lhs) == SSA_NAME)
+ FOR_EACH_IMM_USE_FAST (luse_p, liter, lhs)
+ {
+ gimple *use_stmt = USE_STMT (luse_p);
+ /* BIT_INSERT_EXPR first operand should not be considered
+ a use for the purpose of uninit warnings. */
+ if (gassign *ass = dyn_cast <gassign *> (use_stmt))
+ {
+ if (gimple_assign_rhs_code (ass) == BIT_INSERT_EXPR
+ && luse_p->use == gimple_assign_rhs1_ptr (ass))
+ {
+ has_bit_insert = true;
+ break;
+ }
+ }
+ }
+ if (has_bit_insert)
+ continue;
+
/* Limit the walking to a constant number of stmts after
we overcommit quadratic behavior for small functions
and O(n) behavior. */