]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/125146 - fold_stmt fails to release SSA names
authorRichard Biener <rguenther@suse.de>
Mon, 4 May 2026 09:02:01 +0000 (11:02 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 4 May 2026 11:20:12 +0000 (13:20 +0200)
When match-and-simplify simplification fails we have to release
eventually pushed stmts.

PR middle-end/125146
* gimple-fold.cc (fold_stmt_1): Discard stmts in seq
after failed gimple_simplify as well.

gcc/gimple-fold.cc

index 501c12451162808783a021ad84cac41f3dcd9701..4ec6cc65e3a701281d0939ec9244c05d34857220 100644 (file)
@@ -6880,14 +6880,12 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree),
       gimple_seq seq = NULL;
       gimple_match_op res_op;
       if (gimple_simplify (stmt, &res_op, inplace ? NULL : &seq,
-                          valueize, valueize))
-       {
-         if (replace_stmt_with_simplification (gsi, &res_op, &seq, inplace,
-                                               dce_worklist))
-           changed = true;
-         else
-           gimple_seq_discard (seq);
-       }
+                          valueize, valueize)
+         && replace_stmt_with_simplification (gsi, &res_op, &seq, inplace,
+                                              dce_worklist))
+       changed = true;
+      else
+       gimple_seq_discard (seq);
     }
 
   stmt = gsi_stmt (*gsi);