Skip to content

build-script: Don't automatically clear the module cache. #5186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

adrian-prantl
Copy link
Contributor

Background
Since PR4779 LLVM builds with with -DLLVM_ENABLE_MODULES=1. On Darwin, this turns on -gmodules which causes debug info for the types defined by the LLVM modules is stored alongside the modules in the module cache.
This makes building LLVM several minutes faster and shaves off several gigabytes of redundant debug info from the build directory.
http://llvm.org/devmtg/2015-10/slides/Prantl-ExonSmith-DebugInfoMetadataToModules.pdf

The Problem
The swift/utils/build-script has the nasty habit of unconditionally deleting the module cache on every invocation. Deleting the module cache on every invocation of build-script without re-building the LLVM and clang modules will erase the debug info and thus render any LLVM types undebuggable.

The Solution
This patch removes this functionality. When a clean build is desired, such as on build bots or after master-next merges, the module cache will still be removed since it is located in the build.

Risks
Incremental buildbots will probably still want to clear the module cache to avoid glitches when clang is advanced. I am not sure what the cleanest way to guarantee this is.

rdar://problem/28655564

On Darwin, LLVM builds with -gmodules which causes debug info for the
types defined by the LLVM modules is stored alongside the modules in the
module cache. Deleting the module cache on every re-invocation of
build-script without re-building the LLVM and clang modules will erase
the debug info and thus render any LLVM types undebuggable.

rdar://problem/28655564
@jrose-apple
Copy link
Contributor

This used to be necessary to make sure API notes got updated properly, but that's finally been fixed on master. As long as we don't need to cherry-pick this to swift-3.0-branch we're probably okay. Probably.

@gottesmm
Copy link
Contributor

gottesmm commented Oct 8, 2016

@adrian-prantl I would add an option to clean the module cache. Then we can make the incremental presets set that.

@adrian-prantl
Copy link
Contributor Author

@gottesmm: After studying the clang sources I convinced myself that it should not even be necessary for incremental bots. The clang module hash (i.e.: the subdirectory holding the individual *.pcm files) uses getClangFullRepositoryVersion() (which includes the clang git hash) as one of its sources, so every time we bump the clang version number it will use a new subdirectory. Old and obsolete modules will automatically be pruned once their time-to-live expires so we also shouldn't need to worry about filling up the disk with stale modules.
In the interest of no further complicating the already huge build-script I'd vote for just removing the functionality.

@adrian-prantl adrian-prantl changed the title [WIP] build-script: Don't automatically clear the module cache. build-script: Don't automatically clear the module cache. Oct 10, 2016
@adrian-prantl
Copy link
Contributor Author

meanwhile:
@swift-ci please test

@gottesmm
Copy link
Contributor

@adrian-prantl I defer to you and Jordan on this one. If you guys think it is robust enough, then +1 from me.

@adrian-prantl
Copy link
Contributor Author

Thanks for all the feedback, I'm going to merge this now. I will keep an eye on the bots when we advance clang the next time to make sure it behaves as expected.

@adrian-prantl adrian-prantl merged commit fd47f92 into swiftlang:master Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants