[PATCH] D100509: Support GCC's -fstack-usage flag

Pengxuan Zheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 12:14:44 PDT 2021


pzheng added a comment.

In D100509#2692259 <https://reviews.llvm.org/D100509#2692259>, @xbolva00 wrote:

>   Set current_function_has_unbounded_dynamic_stack_size to 1 when pushing a variable-sized argument onto the stack. 
>   
>         if (current_function_has_unbounded_dynamic_stack_size)
>   	stack_usage_kind = DYNAMIC;
>         else
>   	stack_usage_kind = DYNAMIC_BOUNDED;
>
> https://github.com/gcc-mirror/gcc/commit/d3c12306971946ab9a9d644ddf7b26e9383d2391
>
> You can compile eg. zstd project with "CC="gcc -fstack-usage" make -j6 -B" and then grep "bounded" . -R and you will find some examples of dynamic,bounded.

Thanks, @xbolva00! This is really helpful. I tried compiling the zstd project with both gcc and clang. I found that in all those cases I checked where gcc outputs "dynamic,bounded", clang actually outputs "static" instead. Looks like LLVM already does a better job of determining the frame size statically. So, maybe there is no need to add the "dynamic,bounded" case to clang? Thoughts?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100509/new/

https://reviews.llvm.org/D100509



More information about the cfe-commits mailing list