[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 12:59:31 PDT 2020


asbirlea added a comment.

I think that expanding the patch description will help motivate this and clarify the use-cases for which this is useful, and how it differentiates from `noinline`.
Perhaps include that the attribute aims to avoid merging identical calls so as to keep the separate debug-information for those calls, and that there is an asan usecase where having this attribute would be beneficial to avoid alternative work-arounds.
If you have a link to the feature request for this, include that in the description as well, or include the motivation behind it.

Note there are other LLVM passes (beside SimplifyCFG) that may need to check for this argument to prevent optimizations (e.g. LICM does instruction sinking/hoising, add check ~LICM.cpp:1092?).

Include a comment in the `clang/test/CodeGen/attr-nomerge.c` test on the expected outcome of the test. Something like:
"The attribute no-merge prevents the 3 bar() calls from being merged into one inside foo. Check that there are still 3 tail calls."


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

https://reviews.llvm.org/D78659





More information about the llvm-commits mailing list