Skip to content

Conversation

aschwaighofer
Copy link
Contributor

Add code to create llvm::RemarkStreamer objects for all the LLVMModules in WMO mode.
This way we can collect optimization remarks from the LLVM optimizer and backend.

rdar://154403078

@aschwaighofer
Copy link
Contributor Author

@swift-ci test

}

auto auxRS = std::make_unique<llvm::remarks::RemarkStreamer>(
std::move(*remarkSerializerOrErr), filename);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we set the filter here according to the passed command line argument (similar to

if (llvm::Error err = mainRS->setFilter(passes)) {
), so the filter is consistently applied to the main and aux opt-record files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Comment on lines 1200 to 1203
if (IGM.getOptions().AnnotateCondFailMessage) {
Context.setLLVMRemarkStreamer(
std::make_unique<llvm::LLVMRemarkStreamer>(RS));
// FIXME: add a frontend flag to enable all LLVM remarks
cantFail(RS.setFilter("annotation-remarks"));
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we just enable the LLVM remarks by default for now, I think we should remove this branch/filter entirely, otherwise we filter for annotation remarks in the main file only, but not in the aux files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@aschwaighofer
Copy link
Contributor Author

@swift-ci test

@aschwaighofer aschwaighofer force-pushed the wip_opt_remarks_wmo branch from 5c7e017 to b30bd40 Compare July 1, 2025 14:19
@aschwaighofer
Copy link
Contributor Author

@swift-ci test

@aschwaighofer
Copy link
Contributor Author

@swift-ci test macOS

@aschwaighofer
Copy link
Contributor Author

@swift-ci test linux

@aschwaighofer aschwaighofer merged commit 0442c7c into swiftlang:main Jul 2, 2025
5 checks passed
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.

2 participants