Details
Details
- Reviewers
- tra 
- Commits
- rGfa023e0fe816: [NVPTX] Emit .noreturn directive
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM. Thank you for the patch.
Just curious, does it buy us any measurable improvements?
| llvm/lib/Target/NVPTX/NVPTXUtilities.cpp | ||
|---|---|---|
| 342 | 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);
} | |
Comment Actions
Actually, I haven't tried to measure perf improvements on real tests. Here I fully relay on PTX documentation. I hope this will be beneficial in some cases.
| llvm/lib/Target/NVPTX/NVPTXUtilities.cpp | ||
|---|---|---|
| 342 | I agree, thank you. I moved the assert up. But I think I will be better to leave check for "cast<Function>" unconditional to avoid else-after-return. | |
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); }