Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/SYCLPostLink/SYCLPostLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ llvm::sycl_post_link::performPostLinkProcessing(
if (!SplitImageOrErr)
return SplitImageOrErr.takeError();

MD.release();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can agree. release() function just returns the pointer so that a caller is responsible to destroy the resource which is obviously not happen here. The best solution would be to do:

MD.reset();

This way unique_ptr would destroy the object.
In overall, this is done this way because IRs are fat and we want to release used RAM as soon as possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought deleting the object when the pointer goes out of scope would be the safest if there is any early returns. But sure I can make sure the pointer to release sooner with reset() .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That was just a little optimization of RAM usage because our RAM usage is a known pain point.

MD.reset();
SplitModules.push_back(std::move(*SplitImageOrErr));
}

Expand Down
Loading