This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Inefficient uses of JUMP_P


Hi,

I've been seeing JUMP_P often called on the same pointer as in the
previous invocation.  Code I have in mind is like this:

  if (s->dest == dest
      && any_condjump_p (BB_END (src))
      && onlyjump_p (BB_END (src)))
    delete_insn (BB_END (src));

Note that any_condjump_p calls pc_set, which has a check for JUMP_P,
and that onlyjump_p also checks for JUMP_P.

To visualize this, I instrumented JUMP_P and measured how many times
JUMP_P is called on the same pointer as in the previous invocation.
Here is the result from all of cc1-i files.

# of duplicate invocations: 132468300
# of all invocations:       349866776

That is, about %38 percent of uses are redundant.  This rate is more
or less consistent on each cc1-i file.

In fact, it's not uncommon to see these jump predicates around the
100th in the profile.  They may collectively be using a lot of time.

I am thinking about making these checks the callers' responsibility so
that we will only have to do a single JUMP_P check for each "if"
statement containing several jump predicates.

Any comment?

Kazu Hirata


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]