LevitatingLion added a comment.

While adding tests to clang I realized the attribute is not working as intended 
when using an optimization level of zero, because clang adds the noinline 
attribute to all functions. In this case the optimizer cannot distinguish 
between functions originally marked noinline (where recursive always-inlining 
should stop) and those where clang added the attribute (where recursive 
always-inlining should continue).

Is this acceptable? I think we should fix this, and recursively inline at 
optimization level zero. GCC's documentation on the flatten attribute states 
that "every call inside this function is inlined, if possible", clang's that 
calls are "inlined unless it is impossible to do so".

Maybe we can add an additional string attribute when adding the noinline 
attribute to functions which are not marked noinline in the source code, 
something like "noinline-added-by-clang". I don't know if that's a legitimate 
use case for a string attribute, but it wouldn't be very invasive. What do you 
think?


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

https://reviews.llvm.org/D70366



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to