[PATCH] D104475: [Clang][Codegen] emit noprofile IR Fn Attr for new Fn Attr no_profile

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 17 14:59:58 PDT 2021


nickdesaulniers added a comment.

In D104475#2825711 <https://reviews.llvm.org/D104475#2825711>, @MaskRay wrote:

> So if we don't want to offer guarantee for IR/C/C++ attributes, we can document that users may need to additionally specify `__attribute__((noinline))` to suppress inlining.

I don't generally like that approach:

1. it's not easy for developers to validate their call call chains to ensure that a caller with a restrictive function attribute doesn't have unrestricted callers inlined into the restricted caller.
2. that behavior opposes the principle of least surprise.
3. We don't have a statement attribute for call sites to say "please don't inline this call" which would be fine grain. noinline is a course-grain hammer; what if we want to inline a callee into most callers but not this one caller that has such a restricted function attribute?

See also D91816 <https://reviews.llvm.org/D91816> where I took the conservative approach for `no_stack_protector` and simply chose not to perform such inline substitution on caller and callee function attribute mismatch.  I find this behavior to be the least surprising, and the developer is provided with introspection as to why the compile did not perform such inlining via `-Rpass=inline` flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104475



More information about the cfe-commits mailing list