[PATCH] D140238: [NVPTX] Emit .noreturn directive
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 12:09:01 PST 2022
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.
LGTM. Thank you for the patch.
Just curious, does it buy us any measurable improvements?
================
Comment at: llvm/lib/Target/NVPTX/NVPTXUtilities.cpp:342
+
+ assert(isa<Function>(V) && "Expect either a call instruction or a function");
+
----------------
Nit: The mismatch between assertion condition and the message looks a bit odd. Correct, but odd.
How about restructuring the code like this:
```
assert(isa<Function> || isa<CallInst> ...)
if (const CallInst *CallI = dyn_cast<CallInst>(V)) {
return CallI->doesNotReturn() &&
CallI->getFunctionType()->getReturnType()->isVoidTy();
} else {
const Function *F = cast<Function>(V);
return F->doesNotReturn() &&
F->getFunctionType()->getReturnType()->isVoidTy() &&
!isKernelFunction(*F);
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140238/new/
https://reviews.llvm.org/D140238
More information about the llvm-commits
mailing list