Skip to content

Emit coverage mappings for all modules #32216

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
Jun 10, 2020

Conversation

keith
Copy link
Member

@keith keith commented Jun 6, 2020

Previously in WMO builds where IR was multithreaded only the
primary module would emit the coverage mapping leading to only the first
object file to have the __llvm_covmap section. This change emits
coverage for all modules so they are correctly reflected in the final
coverage report.

This fixes https://forums.swift.org/t/code-coverage-with-wmo/32561/

Fixes rdar://42562585
Fixes rdar://42562307

@theblixguy theblixguy requested a review from vedantk June 6, 2020 01:05
@keith
Copy link
Member Author

keith commented Jun 6, 2020

Updated with a test

Copy link
Contributor

@vedantk vedantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Previously in WMO builds where IR was multithreaded only the
primary module would emit the coverage mapping leading to only the first
object file to have the __llvm_covmap section. This change emits
coverage for all modules so they are correctly reflected in the final
coverage report.
@keith keith force-pushed the ks/coverage-modules branch from aa7258c to 8215ea1 Compare June 8, 2020 23:35
@keith keith requested a review from vedantk June 8, 2020 23:36
Copy link
Contributor

@vedantk vedantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks again for this. You may encounter issues with swift-ci testing at the moment; our servers in Cupertino are overheating (perhaps due to the weather outside..)

@keith
Copy link
Member Author

keith commented Jun 10, 2020

I don't have permissions or anything so do you mind landing this?

@vedantk
Copy link
Contributor

vedantk commented Jun 10, 2020

@swift-ci smoke test and merge

@vedantk
Copy link
Contributor

vedantk commented Jun 10, 2020

I can't force merge, but I've tried to kick off a CI job which should integrate this.

@keith
Copy link
Member Author

keith commented Jun 10, 2020

totally, thanks!

@keith
Copy link
Member Author

keith commented Jun 10, 2020

Looks like that comment didn't trigger anything, maybe related to yesterday's issues?

@vedantk
Copy link
Contributor

vedantk commented Jun 10, 2020

@swift-ci smoke test and merge

@vedantk
Copy link
Contributor

vedantk commented Jun 10, 2020

Let's try again. This time the 'Test and Merge (smoke test)' job looks like it got queued. As of this morning, there were still HVAC issues in the server room so this may take a few attempts -- sorry for the delay.

@keith
Copy link
Member Author

keith commented Jun 10, 2020

no worries, thanks!

@swift-ci swift-ci merged commit 1fb06f1 into swiftlang:master Jun 10, 2020
@keith keith deleted the ks/coverage-modules branch June 10, 2020 19:37
@compnerd
Copy link
Member

This seems to have caused a regression on the Windows builders:


// SINGLE-OBJECT: llvm_coverage_mapping =

// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 2 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping ="
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way other than -num-threads to control how files are split up into different modules (maybe @eeckstein knows)?

The issue on Windows appears to be that only the IR for one of the modules is printed out. The first '@__llvm_coverage_mapping =' definition is matched, but the second isn't.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're able to quickly test this (I'm spinning up a windows env now) does changing the thread count to 1 change this behavior? I originally did 2 just to make it super clear it was going through the multi-threaded path but 1 also does, so if that affected this that test would still be valid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have access to a Windows environment right now. And I'm not sure I follow your comment here: why should swift only emit the IR for one module, given two source files and -num-threads=2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm definitely not saying it should, it sounds like a bug in -emit-ir only for windows to me, so I was just thinking maybe 1 would avoid that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For historians this was re-merged here #32352

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