[llvm] [WebAssembly] Enable a limited amount of stackification for debug code (PR #136510)
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 16:02:56 PDT 2025
dschuff wrote:
I think this is an interesting idea. Thanks for keeping in mind those constraints for debug info, I think those are basically the right goals to have. Does the code you're testing come from C#/CLR or somewhere else?
With clang's O0 compilation, basically all of the C locals do live on the stack, and are written back on every sequence point, so I would actually not expect this to have much of an effect on debugging for such code, but it might improve code size. We also have a decent number of users who debug in -O1/-Og mode (which IIRC uses `CodeGenOptLevel::Less`), because of the large code size at O0. It looks like full stackification is currently turned on for that case. So it might be worthwhile to try switching to limited stackifcation in that case if it improves debug info at a reasonable cost in in code size. Perhaps enabling this might even allow more debugging to be done with O0 compilation rather than O1, but my wild guess is that the mid-level optimizations that happen at O1 make a bigger difference in code size than this would.
I guess another variation on this could be to do something like enabling register coloring instead, which would reduce the local count (and maybe code size a little, since it could reduce the LEB-encoded local numbers). It's probably easy to try, but my guess is that it wouldn't be as effective as doing this.
/cc @aheejin @sunfishcode
https://github.com/llvm/llvm-project/pull/136510
More information about the llvm-commits
mailing list