This is an archive of the discontinued LLVM Phabricator instance.

Make PredIteratorCache size() logically const. Do not require copying predecessors to get size.
ClosedPublic

Authored by dberlin on Mar 12 2017, 9:41 AM.

Details

Summary

Every single benchmark i can run, on large and small cfgs, fully
connected, etc, across 3 different platforms (x86, arm., and PPC) says
that the current pred iterator cache is a losing proposition.

I can't find a case where it's faster than just walking preds, and in some cases, it's 5-10% slower.

This is due to copying the preds.
It also degrades into copying the entire cfg.

The one operation that is occasionally faster is the cached size.
This makes that operation faster by not relying on having the copies available.

I'm not even sure that is faster enough to be worth it. I, again, have
trouble finding cases where this takes long enough in a pass to be
worth caching compared to a million other things they could cache or
improve.

My suggestion:
We next remove the get() interface.
We do stronger benchmarking of size().
We probably end up killing this entire cache.
/

Event Timeline

dberlin created this revision.Mar 12 2017, 9:41 AM
davide accepted this revision.Mar 12 2017, 1:16 PM
davide added a subscriber: davide.

LGTM. I personally like your plan of removing the cache altogether supported by benchmarks.

This revision is now accepted and ready to land.Mar 12 2017, 1:16 PM
This revision was automatically updated to reflect the committed changes.