Open
Description
#106058 appears to have caused a large compile time regression in LLVM 20. zig-bootstrap used to be able to compile and link the zig
binary for s390x-linux-(gnu,musl)
in a matter of minutes when we were on LLVM 19. Now on LLVM 20, I decided to cancel the build after it had been running for about an hour.
Some investigation shows that a lot of time is being spent in SystemZTTIImpl::adjustInliningThreshold()
, in particular in this section:
llvm-project/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
Lines 98 to 105 in c1c0d55
Some thoughts:
- A module can have lots of globals.
- This doesn't appear to be the problem here, however.
- A global can have lots of users (think common deduplicated/merged constant values).
- This seems to be the case here, though I couldn't determine exactly how many users we're talking about because I was using a
RelWithDebInfo
build of LLVM wherep Global.users()
was optimized out.- Building a
Debug
compiler as I file this to hopefully find out...
- Building a
- This seems to be the case here, though I couldn't determine exactly how many users we're talking about because I was using a
std::set
seems less than ideal compared tostd::unordered_set
here.- I tried changing this to
std::unordered_set
but it didn't seem to have too much of an impact. Still seems desirable to do, though.
- I tried changing this to
In general, all of this seems like a lot of work to be doing on ~every inlining decision.
Metadata
Metadata
Assignees
Type
Projects
Status
Needs Fix