[PATCH] D93946: [FuncAttrs] Infer noreturn
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 08:34:22 PST 2021
jdoerfert added a comment.
In D93946#2495693 <https://reviews.llvm.org/D93946#2495693>, @markus wrote:
> Not terribly important but isn't
>
>> A function is noreturn if all blocks terminating with a ReturnInst contain a call to a noreturn function.
>
> slightly in conflict with the Lint pass containing the following "Unusual" warning?
FWIW, that is not an accurate definition of noreturn since we have endless loops and the calles might not always
be `noreturn` but just for the parameters passed.
> void Lint::visitReturnInst(ReturnInst &I) {
> Function *F = I.getParent()->getParent();
> Assert(!F->doesNotReturn(),
> "Unusual: Return statement in function with noreturn attribute", &I);
>
> if (Value *V = I.getReturnValue()) {
> Value *Obj = findValue(V, /*OffsetOk=*/true);
> Assert(!isa<AllocaInst>(Obj), "Unusual: Returning alloca value", &I);
> }
> }
>
> Well I guess "Unusual" is not really a warning but still it kind of indicates that something is off. So maybe that Lint printout should be removed or updated somehow?
I'd leave the warning if we replace all `ReturnInst` with unreachable. Otherwise it is "unusual".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93946/new/
https://reviews.llvm.org/D93946
More information about the llvm-commits
mailing list