]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
forwprop: Change test in loop of optimize_memcpy_to_memset
authorAndrew Pinski <quic_apinski@quicinc.com>
Tue, 27 May 2025 01:07:25 +0000 (18:07 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 29 May 2025 21:11:54 +0000 (14:11 -0700)
This was noticed in the review of copy propagation for aggregates
patch, instead of checking for a NULL or a non-ssa name of vuse,
we should instead check if it the vuse is a default name and stop
then.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_memcpy_to_memset): Change check
from NULL/non-ssa name to default name.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/tree-ssa-forwprop.cc

index 4c048a9a2986803d35adb6e7308834b1c19aae87..e457a69ed489ae5334d2b611b8683d7b60ccb98b 100644 (file)
@@ -1226,7 +1226,8 @@ optimize_memcpy_to_memset (gimple_stmt_iterator *gsip, tree dest, tree src, tree
   gimple *defstmt;
   unsigned limit = param_sccvn_max_alias_queries_per_access;
   do {
-    if (vuse == NULL || TREE_CODE (vuse) != SSA_NAME)
+    /* If the vuse is the default definition, then there is no stores beforhand. */
+    if (SSA_NAME_IS_DEFAULT_DEF (vuse))
       return false;
     defstmt = SSA_NAME_DEF_STMT (vuse);
     if (is_a <gphi*>(defstmt))