This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Cache computation of regionAsOffset
ClosedPublic

Authored by george.karpenkov on Mar 30 2018, 3:44 PM.

Details

Summary

Achieves almost a 200% speedup on the example where the performance of visitors was problematic.

Performance on sqlite3 is unaffected.

rdar://38818362

Diff Detail

Repository
rC Clang

Event Timeline

NoQ accepted this revision.Mar 30 2018, 6:07 PM

The huge switch in getAsOffset() does really nothing good compared to a virtual function. I suspect that this alone could have made it faster, depending on how the switch is compiled. And with a virtual function, we could also easily add the new field and the lookup only to those 3-4 regions that aren't base regions - which might as well be faster. But this already looks good, we should have tried this earlier!

This revision is now accepted and ready to land.Mar 30 2018, 6:07 PM

I'm not so sure complicated mutual recursion is better than a loop...

This revision was automatically updated to reflect the committed changes.