[PATCH] D76140: [InlineFunction] update attributes during inlining

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 18:22:12 PDT 2020


anna added a comment.

In D76140#1922555 <https://reviews.llvm.org/D76140#1922555>, @reames wrote:

> Anna,  I'd encourage you to go very narrow here.  We can resolve the correlated throw case with the following:  require operand of return to be call instruction which is less than small constant window of non-trapping instructions before the return.  (i.e. start with previous node)  If we allow bitcasts, that provides reasonable coverage.  We can always fallback to assumes as noted.
>
> We don't need to be hugely general analysis wise to be very useful.  Calls in tail positions or loads in analogous are very common.  We should handle that obvious case.


Philip, I think we need to be even more conservative. I don't see how this will handle the parameter of the call instruction being incorrectly optimized away (second example with "returned" attribute on the parameter). IIUC, these are the two restrictions we need:

1. no throwing instructions between the call (i.e. the operand of the return) and the returnInstruction - possible restrict to small constant window like you described.
2. the arguments for the call should feed directly from the arguments in the callee (we can have bitcasts/geps here - i.e. use `stripAndAccumulateConstantOffsets`). This avoids possible incorrect propagation to the argument of the call


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76140





More information about the llvm-commits mailing list