[PATCH] D93946: [FuncAttrs] Infer noreturn
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 30 12:03:55 PST 2020
aeubanks marked an inline comment as done.
aeubanks added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:1400
+
+ bool CanReturn = false;
+ // The function can return if any basic blocks terminating with a ReturnInst
----------------
madhur13490 wrote:
> I think you can actually avoid this variable. You can declare "FoundNoReturnCall" outside the loops and define it in each iteration of the outer loop. If (!FoundNoReturnCall) in outer loop then break and if (FoundNoReturnCall) outside the loop then F->setDoesNotReturn(). CanReturn is acting as an accumulator here but if you declare FoundNoReturnCall outside the loop then it can act for the same purpose.
I'm not following, could you post the code?
This is basically an `all(any())` where the `all` means "every basic block must" and the `any` means "any instruction in the block doesn't return". I believe you need two variables for `all(any())`.
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