Sorry if this is documented somewhere, GCC has a page documenting what optimizations have been done in each optimization level, also gracefully with simple explanation on each. GCC supports levels including 0-3, s, and z, etc. In that page, it says when using -O1, you turn on flags from -fauto-inc-dec to -funit-at-a-time, and when using -O2, you turn on more like -falign-functions and I can read some explanation on them each below.
I know rustc has similar (at least in their names) optimization levels, and can be specified using -Copt-level=# way, I also know rustc's doc provides general explanation on each level, but I couldn't find out what specific optimizations (or, flags) have been done (or, set) in each of them.
Does rustc has something like doc of optimization flags that I can refer to? Or I could find them in LLVM's or Clang's doc?
I would like to dive into it because I wrote some codes (you bet, unsafe) that behaved differently in debug and release profile, so I want to know what optimization(s) might have caused this.