Hi,

On Mon, 5 Mar 2018, Jeff Law wrote:

> >> The single successor test was strictly my paranoia WRT abnormal/EH 
> >> edges.
> >>
> >> I don't immediately see why the CFG would be incorrect if the 
> >> successor of the setjmp block has multiple preds.
> > 
> > Actually, without further conditions I don't see how it would be safe 
> > for the successor to have multiple preds.  We might have this 
> > situation:
> > 
> > bb1: ret = setjmp
> > bb2: x0 = phi <x1 (bb1), foo(bbX)>
> No.  Can't happen -- we're still building the initial CFG.  There are no
> PHI nodes, there are no SSA_NAMEs.

While that is currently true I think it's short-sighted.  Thinking about 
the situation in terms of SSA names and PHI nodes clears up the mind.  In 
addition there is already code which builds (sub-)cfgs when SSA form 
exists (gimple_find_sub_bbs).  Currently that code can't ever generate 
setjmp calls, so it's not an issue.

> We have two choices we can either target the setjmp itself, which is
> what we've been doing and is inaccurate.  Or we can target the point
> immediately after the setjmp, which is accurate.

Not precisely, because the setting of the return value of setjmp does 
happen after both returns.  So moving the whole second-return edge target 
to after the setjmp call (when it includes an LHS) is not correct 
(irrespective how the situation in the successor BBs like like).

> > As you noted the second "return" from setjmp is precisely after the setjmp 
> > call itself, i.e. on the edge bb1->bb2.  Simply regarding it as landing at 
> > the start of bb2 it becomes unclear from which edge bb2 was entered and 
> > hence the runtime model of PHI nodes breaks down.
> ?!?    Again, we don't have PHIs and we're not simply regarding the
> setjmp as landing at the start of BB2.  We are creating an edge from the
> dispatcher to BB2.

Sure, the dispatcher is in between, but I don't regard it as material for 
the issue at hand: it's really
 ret=setjmp --(ab)-> dispatch --(ab)-> XXX
 any-other-call --(ab)-> dispatch
and the question is what XXX should be.  It should be after setjmp for 
precision, but must be before 'ret='.  I was ignoring the dispatcher and 
just said that setjmp and all calls directly transfer to XXX (and then 
discussed what the XXX may be).

So, even if you chose to ignore SSA names and PHI nodes (which probably is 
fine for gcc8) you still have a problem of ignoring the effect on the LHS.


Ciao,
Michael.

Reply via email to