On Mon, Nov 24, 2025 at 3:08 PM Andrew Pinski <[email protected]> wrote: > > As mention in the patch that adds DSEing lhs of calls, > some testcases were xfailed due to exceptions and mismatch > of clobbers in some cases. > This allows them and un-xfails the testcase where they show > up. > > Bootstrapped and tested on x86_64-linux-gnu.
OK. Richard. > gcc/ChangeLog: > > * tree-ssa-forwprop.cc (do_simple_agr_dse): Allow > for mismatched clobbers. > > gcc/testsuite/ChangeLog: > > * g++.dg/tree-ssa/simple-dse-3.C: un-xfail. > > Signed-off-by: Andrew Pinski <[email protected]> > --- > gcc/testsuite/g++.dg/tree-ssa/simple-dse-3.C | 6 +++--- > gcc/tree-ssa-forwprop.cc | 9 ++++----- > 2 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/gcc/testsuite/g++.dg/tree-ssa/simple-dse-3.C > b/gcc/testsuite/g++.dg/tree-ssa/simple-dse-3.C > index dc31eff3be3..3b3bcc0174d 100644 > --- a/gcc/testsuite/g++.dg/tree-ssa/simple-dse-3.C > +++ b/gcc/testsuite/g++.dg/tree-ssa/simple-dse-3.C > @@ -20,9 +20,9 @@ void func3(int a) > struct s1 p1 = pure1(a); > } > > -// { dg-final { scan-tree-dump "Removing dead call store stmt p1 =" > "forwprop1" { xfail *-*-* } } } > +// { dg-final { scan-tree-dump "Removing dead call store stmt p1 =" > "forwprop1" } } > // { dg-final { scan-tree-dump-not "Removing dead call store stmt v1 =" > "forwprop1" } } > // { dg-final { scan-tree-dump-not "Removing lhs of call stmt " "forwprop1" > } } > -// { dg-final { scan-tree-dump-times "Removing dead call store stmt" 1 > "forwprop1" { target { ! c++26 } xfail *-*-* } } } > -// { dg-final { scan-tree-dump-times "Removing dead call store stmt" 2 > "forwprop1" { target c++26 xfail *-*-* } } } > +// { dg-final { scan-tree-dump-times "Removing dead call store stmt" 1 > "forwprop1" { target { ! c++26 } } } } > +// { dg-final { scan-tree-dump-times "Removing dead call store stmt" 2 > "forwprop1" { target c++26 } } } > > diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc > index a744e224d99..c9a57d67ade 100644 > --- a/gcc/tree-ssa-forwprop.cc > +++ b/gcc/tree-ssa-forwprop.cc > @@ -1791,7 +1791,6 @@ do_simple_agr_dse (gassign *stmt, bool full_walk) > /* Only handle clobbers of a full decl. */ > if (!DECL_P (lhs)) > return; > - clobber_kind kind = (clobber_kind)CLOBBER_KIND (gimple_assign_rhs1 (stmt)); > ao_ref_init (&read, lhs); > tree vuse = gimple_vuse (stmt); > unsigned limit = full_walk ? param_sccvn_max_alias_queries_per_access : 4; > @@ -1813,20 +1812,20 @@ do_simple_agr_dse (gassign *stmt, bool full_walk) > basic_block ubb = gimple_bb (use_stmt); > if (stmt == use_stmt) > continue; > - /* If the use is the same kind of clobber for lhs, > + /* If the use is a clobber for lhs, > then it can be safely skipped; this happens with eh > and sometimes jump threading. */ > - if (gimple_clobber_p (use_stmt, kind) > + if (gimple_clobber_p (use_stmt) > && lhs == gimple_assign_lhs (use_stmt)) > continue; > /* If the use is a phi and it is single use then check if that > single use > - is a clobber of the same kind and lhs is the same. */ > + is a clobber and lhs is the same. */ > if (gphi *use_phi = dyn_cast<gphi*>(use_stmt)) > { > use_operand_p ou; > gimple *ostmt; > if (single_imm_use (gimple_phi_result (use_phi), &ou, &ostmt) > - && gimple_clobber_p (ostmt, kind) > + && gimple_clobber_p (ostmt) > && lhs == gimple_assign_lhs (ostmt)) > continue; > /* A phi node will never be dominating the clobber. */ > -- > 2.43.0 >
