LLC debugging info


I was wondering, how do I force llc to do all optimizations except those that cause re-ordering, or whatever else that invalidates debugging info? I know I can keep it at -O0 to avoid such invalidation, but ideally, I’d like to take advantage of all the other optimizations (eliminating useless mov’s, etc.)

My input is a bitcode file with a distinct DILocation/other relevant debugging info on every instruction.

Thank you!

There isn’t a mode specifically designed to avoid disturbing debug info. Probably the closest match would be -O1. Alternatively (and this is much more work for you) explicitly run just the passes that don’t mess up your debugging.

Oh ok, thank you for your reply!