Why my '-cross-module-optimization' does not work?

I set up a test project in Xcode to experiment with Cross-Module Optimization (CMO) in Swift. In my custom SPM package, I included a public function that isn't being used by other targets. To apply CMO, I updated the target's settings with the following Swift configuration: target.swiftSettings = [.unsafeFlags(["-cross-module-optimization"])].
However, for this target with unused function i see no changes: compiled binary size decreases with removing this public funс from code, i.e compiler cannot eliminate it during this cross module optimization. What I do wrong?