[libcxx-commits] [PATCH] D96966: [libc++] Remove temporary stack-allocated array pointer
Dominic Chen via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 18 14:31:59 PST 2021
ddcc added a comment.
Here is the IR output for a small example, in the `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__zeroEv` function: https://godbolt.org/z/174Pav
At O0, the reference to `__a` is lowered as a stack-allocated temporary array pointer, which stores the value of `__r_.first().__r.__words`. Then, it is loaded back out from `__a` in every iteration of the loop body and combined with `__i` in a GEP expression. This change does remove the temporary from being emitted at O0, although the mem2reg pass does eliminate it at higher optimization levels.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits