Optimization is a part of the compilation/linking process. You cannot really separate it from that process. Your best bet is to look at the actual assembly code created by your compiler. As far as the real-world impact of optimization is concerned that’s the result that matters.
Probably best known in the C++ world is the online Compiler Explorer by Matt Goldbolt where you can compile and look at the assembly created by a wide variety of compilers, platforms and settings. Also, you get a pretty good visual mapping between lines in your C++ code and the corresponding assembly.
I seem to remember vaguely that Visual Studio has a similar mode that shows assembly mapped to the source code. If that’s your IDE you might want to look into it.