[PATCH] D119571: [funcattrs] check reachability to improve noreturn

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 12:38:43 PST 2022


nickdesaulniers added a comment.

In D119571#3320199 <https://reviews.llvm.org/D119571#3320199>, @rnk wrote:

> Do we know which pass introduces unreachable code without cleaning it up? That seems like a missed optimization, possibly a phase ordering issue, or we could tack on a `removeUnreachableBlocks` to whichever pass is modifying the CFG in the first place.

In this particular case, there is no pass introducing an unreachable; the unreachable is explicit in the source.

Because there's analog for `__attribute__((noreturn))` for inline asm, the Linux kernel frequently uses the pattern:

  asm ("<instruction that will trap>");
  __builtin_unreachable();


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119571/new/

https://reviews.llvm.org/D119571



More information about the llvm-commits mailing list