OSDN Git Service

Make PredIteratorCache size() logically const. Do not require copying predecessors...
authorDaniel Berlin <dberlin@dberlin.org>
Tue, 14 Mar 2017 11:25:45 +0000 (11:25 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Tue, 14 Mar 2017 11:25:45 +0000 (11:25 +0000)
commitc8d396a8a7e4abdbd86f78bb9aa78c7a3e0e2f0b
treef32e484a6ccbb1fbe3a67d4fecc1c545bf0c4192
parent51258d9cbde9759ad6e639d1f783b04c3d7a09bf
Make PredIteratorCache size() logically const. Do not require copying predecessors to get size.

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.
/

Reviewers: chandlerc

Subscribers: aemerson, llvm-commits, trentxintong

Differential Revision: https://reviews.llvm.org/D30873

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297733 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/PredIteratorCache.h