[libcxx-commits] [PATCH] D96966: [libc++] Remove temporary stack-allocated array pointer

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 19 08:02:31 PST 2021

ldionne added a comment.

In D96966#2572873 <https://reviews.llvm.org/D96966#2572873>, @ddcc wrote:

> 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 in `__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.

Oh, thanks for the clarification. So the temporary was the pointer to the array. I thought we were trying to eliminate a stack allocated array. Anyway, it looks like this is not relevant anyway. Thank you!

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list