[gcc r17-3253] dce: Fix check for no_delete for removing the lhs of a call

Andrea Pinski via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:424bd64ef45e001c425c18652d0dca1d7ad98928

commit r17-3253-g424bd64ef45e001c425c18652d0dca1d7ad98928
Author: Andrea Pinski <[email protected]>
Date:   Thu Aug 13 00:06:57 2026 -0700

    dce: Fix check for no_delete for removing the lhs of a call
    
    I only noticed after doing a bootstrap/test and pushing the
    patch that I messed up the conditional. There was no failure
    there so I suspect it was not being tested and most likely
    does not run into the issue of why no_delete was added either.
    
    Pushed the fix after a build.
    
    gcc/ChangeLog:
    
            * tree-ssa-dce.cc (simple_dce_from_worklist): Fix conditional
            for no_delete with a call.
    
    Signed-off-by: Andrea Pinski <[email protected]>

Diff:
---
 gcc/tree-ssa-dce.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
index 9fdd102442a6..18bc851b2cdd 100644
--- a/gcc/tree-ssa-dce.cc
+++ b/gcc/tree-ssa-dce.cc
@@ -2224,8 +2224,8 @@ simple_dce_from_worklist (bitmap worklist, bitmap need_eh_cleanup,
       if (gimple_has_side_effects (t))
 	{
 	  gcall *call = dyn_cast <gcall *> (t);
-	  // For no delete don't remove the lhs.
-	  if (call && no_delete)
+	  // Remove the lhs for a call if not no_delete.
+	  if (call && !no_delete)
 	    {
 	      gimple_call_set_lhs (call, NULL_TREE);
 	      update_stmt (call);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.