Open pcwalton opened 4 years ago
We already run most MIR optimizations in debug mode, IIRC the plan is to do the same for inlining (perhaps with a lower threshold than when optimizations are turned on).
I'm surprised that doing the optimizations doesn't harm debuggability.
Debug mode, which is key to the edit-compile-run cycle, generates a lot more LLVM IR than equivalent C/C++ code does. For example, things like calls to
ptr::write
actually turn into procedure calls at the machine level, whereas they should really always be inlined. We could consider actually performing a subset of MIR optimizations in debug mode, to produce simpler IR and therefore to reduce compile time and improve performance of debug mode code. Naturally, these optimizations need to be carefully written to preserve DWARF debug info, but DWARF has many features designed to enable this sort of thing.