Honza,

You mentioned recently that you are making changes in IPA-CP wrt
clones.  Simon recently found a test case that I'm hoping will be
handled by your changes.  Essentially, the problem happens when we
clone a node for IPACP whose caller is itself cloned.
In this case (attached), we have a function Baz() making two calls
Bar(0) and Bar(1).  Also, there are two cgraph nodes for Baz (Baz/1
and Baz/5) and 4 cgraph nodes for Bar (Bar/0, Bar/4, Bar/6 and Bar/7).
 All these clones were created by the inliner (which happens to run
before IPA-CP when using -fwhopr).

When IPA-CP decides to clone Bar/0, it creates the ipcp clone T.0 and
replaces the edge Baz/1->Bar/0 with Baz/1->T.0.  At the same time, it
modifies the function body for Baz() to call T.0() instead of Bar(0).

So, now we have updated the cgraph node Baz/1 correctly, but it is
impossible to update the cgraph node Baz/5 since Baz/5 never had a
reference to Bar/0.  This causes a cgraph verification failure when we
analyze the gimple body of Baz and find a call to T.0 but no such edge
in Baz/5.

The easy way out of this is to refuse to clone Bar/0.  Since Baz is
itself cloned, we would need to make a duplicate of Baz's body to
handle this case.

You can reproduce this problem by compiling with -fwhopr in the branch
or by simply switching the order of pass_ipa_inline and pass_ipa_cp in
mainline (though that will probably give you a different IPACP failure
as we have some changes for it in the branch).

Should I file a bug report or are you handling this situation already?


Thanks.  Diego.

Reply via email to