[PATCH] D76140: [InlineFunction] update attributes during inlining
Anna Thomas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 04:51:20 PDT 2020
anna marked an inline comment as done.
anna added inline comments.
Herald added a reviewer: aartbik.
================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1172
+ return true;
+ return false;
+ };
----------------
jdoerfert wrote:
> `mayThrow` is not sufficient. As with my earlier example, a potential `exit` is sufficient to break this, thus you need `willreturn` as well.
What we need is just `isGuaranteedToTransferExecutionToSuccessor`. That handles `mayThrow`, exits/pthread_exit and willreturn.
Just to note, an unconditional exit in the callee itself is not an issue here. The problem is something like this:
```
;nothrow
foo(i8* %arg) {
if (%arg == null)
exit;
ret %arg
}
callee() {
%r = call i8* @bar
%v = call i8* @foo(i8* %r)
ret i8* %r
}
caller() {
call nonnull i8* @callee
}
```
Here propagating nonnull to callsite `bar` is incorrect since if %r is null, the program exits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76140/new/
https://reviews.llvm.org/D76140
More information about the cfe-commits
mailing list