[libunwind] [libunwind] Remove unnecessary strcpy dependency (PR #72043)

Michael Kenzel via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 12 14:52:27 PST 2023


michael-kenzel wrote:

> I would assume this is already transformed to memcpy but I guess it won't be for -O0

[I did some testing on this](https://godbolt.org/z/YMEjbxYd9): it seems that gcc replaces the `strcpy` with a simple `mov` even under `-O0`, but not the `memcpy`. clang does the reverse: it replaces the `memcpy` with a `mov` even under `-O0` but not the `strcpy`. So it's a bit of a wash (I didn't expect either compiler to transform any of these with `-O0` tbqh). Though since libunwind is primarily meant to be used with LLVM, this change arguably presents the tiniest codegen improvement. On either compiler, turning on optimizations (even just to `-O1`) results in the exact same codegen from either version (as one would expect).

https://github.com/llvm/llvm-project/pull/72043


More information about the cfe-commits mailing list