Getting optimization information using the `-Rpass` flags

I would like to get information about optimization passes performed/missed by swiftc in my swiftpm project using the "-Rpass", "-Rpass-missed" etc flags. I added them to my target executable by passing them as unsafeFlags to the exectable target's swiftSettings and built the project from the command line using swift build -c release, but there is no additional output emitted in stderr. Where can I find the emitted optimization pass information?

On looking around a bit more, I did find a file .build/arm64-apple-macosx/release/Executable.build/Executable.opt.yaml by poking around using commands like grep -rI "inline" .. Is this it, is this the -Rpass output?

Edit: This was the information emitted by "-save-optimization-record" I believe, because removing this flag also removed the file on fresh build. So, still cannot find the information emitted by -Rpass and friends. Is -save-optimization-record all that I need?

1 Like