https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61776

--- Comment #6 from wmi at google dot com ---
(In reply to davidxl from comment #5)
> (In reply to wmi from comment #4)
> > Can we move the pure/const resetting loop to an earlier place: inside
> > branch_prob , after instrument_edges and before gsi_commit_edge_inserts
> > (where stmt_ends_bb_p  is checked), so that gsi_commit_edge_inserts() which
> > changes cfg could take reset const/pure flags into consideration?
> 
> Sounds plausible. Have you tried it?
> 
> David

I just tried but found it was not very easy.

FOR_EACH_DEFINED_FUNCTION (node) {
  execute_fixup_cfg() and cleanup_tree_cfg()
  branch_prob()
}

For the above loop, branch_prob is called one by one for each defined func.
Because a func could possibly call any other funcs on the cgraph, we need to
reset the const/pure flags for every defined func before any branch_prob() is
called, so we cannot put the const/pure reset code inside branch_prob().

We also cannot move the const/pure reset loop before the branch_prob() loop,
because execute_fixup_cfg will use const/pure flags to generate different cfg.
If we put the const/pure reset code before the branch_prob() loop, the
const/pure reset code should only be executed in intrumentation phase, not in
annotation phase, so that we may get different cfg between intrumentation and
annotation.

Wei.

Reply via email to