This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 41469 followup: improve __builtin_stack_restore removal
> But given that it's not showing up now, I'm not too concerned.
> I don't see how the nothrow builtins that I was manipulating
> could lead to EH CFG errors, so I assume it was something
> totally unrelated which has since been fixed.
OK, here's the story: your patch triggered the 3 failures because because it
allowed the compiler to better optimize the testcases after the "fab" pass.
For a reduced version of c37003a, "dse2" was handed down
_ada_c37003a ()
{
void * D.2079;
struct c37003a__rec1 * r1a.7;
void * D.2064;
struct c37003a__rec1 * r1.4;
<bb 2>:
D.2064_71 = alloca (8);
r1.4_72 = (struct c37003a__rec1 *) D.2064_71;
r1.4_72->a1[1]{lb: 1 sz: 4} = 1;
<bb 3>:
r1.4_72->a2[1]{lb: 1 sz: 4} = 1;
goto <bb 5>;
<L23>:
goto <bb 11> (<L21>);
<bb 5>:
D.2079_94 = alloca (8);
r1a.7_95 = (struct c37003a__rec1 *) D.2079_94;
r1a.7_95->a1[1]{lb: 1 sz: 4} = 1;
goto <bb 7>;
<L24>:
goto <bb 11> (<L21>);
<bb 7>:
r1a.7_95->a2[1]{lb: 1 sz: 4} = 1;
goto <bb 9>;
<L25>:
goto <bb 11> (<L21>);
<bb 9>:
return;
<L22>:
<L21>:
resx 1
}
and eliminated the 2 dead stores in BB2 and BB5 without removing the EH edges,
yielding
c37003a.adb:1:1: error: BB 2 can not throw but has an EH edge
c37003a.adb:1:1: error: BB 5 can not throw but has an EH edge
Unlike tree-ssa-dom.c, tree-ssa-dse.c doesn't have a need_eh_cleanup machinery
so that's not very surprising; that it only showed up yesterday is more.
After Michael's patch:
* passes.c (init_optimization_passes): Move pass_fold_builtins
after last phiopt pass.
the "fab" pass runs much later so the stores are not dead by the time "dse2"
is run. As a matter of fact, there are not eliminated at all, "optimized"
still has them:
_ada_c37003a ()
{
void * D.2196;
void * saved_stack.8;
void * D.2079;
struct c37003a__rec1 * r1a.7;
void * D.2064;
struct c37003a__rec1 * r1.4;
<bb 2>:
saved_stack.8_3 = 0B;
D.2064_71 = alloca (8);
r1.4_72 = (struct c37003a__rec1 *) D.2064_71;
r1.4_72->a1[1]{lb: 1 sz: 4} = 1;
<bb 3>:
r1.4_72->a2[1]{lb: 1 sz: 4} = 1;
<bb 4>:
D.2079_94 = alloca (8);
r1a.7_95 = (struct c37003a__rec1 *) D.2079_94;
r1a.7_95->a1[1]{lb: 1 sz: 4} = 1;
<bb 5>:
r1a.7_95->a2[1]{lb: 1 sz: 4} = 1;
<bb 6>:
GIMPLE_NOP
return;
<L21>:
GIMPLE_NOP
D.2196_126 = __builtin_eh_pointer (1);
_Unwind_Resume (D.2196_126);
}
so it looks like the benefits of your patch have been partially voided.
--
Eric Botcazou