llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[LazyCallGraph][Inliner] Large compile-time slow down when using new pass manager

Open llvmbot opened this issue 9 years ago • 9 comments

Bugzilla Link 35110
Resolution FIXED
Resolved on Jun 30, 2021 11:25
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @ekatz,@fhahn,@nemanjai,@sanjoy,@yuanfang-chen

Extended Description

While testing the new pass manager we identified a case where one input file regressed in compile-time by ~548x.

The primary issue appears to be the call to LazyCallGraph::RefSCC::insertTrivialRefEdge() in the Inliner. If the verify() call is removed from insertTrivialRefEdge() the regression is greatly reduced.

llvmbot avatar Oct 27 '17 19:10 llvmbot

Fixed by 468fa03

yuanfang-chen avatar Jun 30 '21 18:06 yuanfang-chen

This is really unexpected (as one who never set LLVM_ENABLE_ASSERTIONS explicitly), that this flag undefines NDEBUG, and actually defines _DEBUG (on non a MSVC build). Is this the only way to enable asserts?

In any case, maybe we can move the call to "verify()" under the "#ifdef EXPENSIVE_CHECKS"? as it seems pretty expensive.

ekatz avatar Jan 11 '20 20:01 ekatz

I can't reproduce it in release mode, and according to the bug description, the issue is in the call to "verify()", which is done only in debug mode. I can confirm that it is actually reproducible in debug mode, but then the debug version is much MUCH slower in many aspects that the release mode. So I'll ask, is this a real issue?

Yes I think that is an issue unfortunately. Using CMAKE_BUILD_TYPE=Release together with LLVM_ENABLE_ASSERTIONS=On is quite a common build configuration (also for various buildbots). Large compile time regressions for this config potentially impact a large number of users.

fhahn avatar Jan 11 '20 19:01 fhahn

I can't reproduce it in release mode, and according to the bug description, the issue is in the call to "verify()", which is done only in debug mode. I can confirm that it is actually reproducible in debug mode, but then the debug version is much MUCH slower in many aspects that the release mode. So I'll ask, is this a real issue?

ekatz avatar Jan 11 '20 19:01 ekatz

Seems that there has been no movement on this in the last couple of years. I would say that this is one of the key reasons we cannot switch to the NPM internally. If nobody more familiar with the NPM is available to resolve this, we might find some time to gain the knowledge to resolve it - but ideally someone knowledgeable can at least point us in the right direction.

nemanjai avatar Dec 03 '19 01:12 nemanjai

We generally use dropbox/google drive and link here for large files/binaries (e.g. for lld repros)

Thanks, Davide. Creating a tar.gz got it under the limit.

llvmbot avatar Oct 27 '17 20:10 llvmbot

Test case Reproduce with:

opt < test.bc -passes='cgscc(inline)'

vs

opt < test.bc -inline

llvmbot avatar Oct 27 '17 20:10 llvmbot

We generally use dropbox/google drive and link here for large files/binaries (e.g. for lld repros)

llvmbot avatar Oct 27 '17 20:10 llvmbot

Unfortunately, the test file exceeds the maximum allowance, so I can't attach it to the bug. Do you mind if I just send it to you directly, Chandler?

llvmbot avatar Oct 27 '17 19:10 llvmbot