This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Improve LazyValueInfo compile time performance
ClosedPublic

Authored by bruno on Jul 30 2015, 8:45 AM.

Details

Summary

Changes in LoopUnroll in the past six months exposed scalability
issues in LazyValueInfo when used from JumpThreading. One internal test
that used to take 20s under -O2 now takes 6min.

This patch makes a couple of changes to speed-up LazyValueInfo and
reduces compile time to 1m20s.

  • Change the OverDefinedCache from

DenseSet<std::pair<AssertingVH<BasicBlock>, Value*>>
to
DenseMap<AssertingVH<BasicBlock>, SmallPtrSet<Value *, 4>>

  • Use DenseMap instead of std::map for ValueCacheEntryTy. Historically

there seems to be some resistance regarding the change to DenseMap
(r147980), but I couldn't find cases of iterator invalidation for
ValueCacheEntryTy (only for ValueCache, but this one is left unchanged

  • still using std::map).

Diff Detail

Event Timeline

bruno updated this revision to Diff 31032.Jul 30 2015, 8:45 AM
bruno retitled this revision from to [LVI] Improve LazyValueInfo compile time performance.
bruno updated this object.
bruno added reviewers: resistor, hfinkel, reames.
bruno added subscribers: llvm-commits, dexonsmith.
hfinkel accepted this revision.Aug 10 2015, 2:19 AM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Aug 10 2015, 2:19 AM
bruno closed this revision.Aug 18 2015, 9:56 AM

Thanks,

Committed in r245309 and r245314.