This is an archive of the discontinued LLVM Phabricator instance.

Replace two RecursiveASTVisitor insantiations with StmtVisitor
Needs ReviewPublic

Authored by rnk on Jan 24 2019, 5:06 PM.

Details

Reviewers
arphaman
rsmith
Summary

RecursiveASTVisitor is very expensive to instantiate and results in
needlessly slow compilation. For these availability check fixits, we
don't need to instantiate the full complexity of the declaration walking
machinery, we can use a plain StmtVisitor.

This change reduces time to compile SemaDeclAttr.cpp and saves object
file size:

beforeafter
time (s)1m7.821s0m52.459s
obj (kb)1328011364

So, 15s and 1.9 MB of object file. If clang had presubmits checks, I'd
add a check that warned on new inclusions of RecursiveASTVisitor.h. =/

I won't promise that this doesn't change functionality, since RAV walks
through quite a number of things that StmtVisitor doesn't, like blocks
and lambdas.

I noticed that SemaOpenMP has a very similar utility called
LocalVarRefChecker, so there is definitely some opportunity for
refactoring further after this.

Event Timeline

rnk created this revision.Jan 24 2019, 5:06 PM
rnk edited the summary of this revision. (Show Details)Jan 25 2019, 4:37 PM