[PATCH] D32246: Don't emit CFI instructions at the end of a function

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 14:35:30 PDT 2017


aprantl created this revision.
Herald added subscribers: nemanjai, jyknight.

When functions are terminated by unreachable instructions, the last
instruction might trigger a CFI instruction to be generated. However,
emitting it would be be illegal since the function (and thus the FDE the CFI is in)
has already ended with the previous instruction.

      

Darwin's dwarfdump --verify --eh-frame complains about this and the
specification supports this.    
Relevant bits from the DWARF 5 standard (6.4 Call Frame Information):

  "[The] address_range [field in an FDE]: The number of bytes of
   program instructions described by this entry."
      
  "Row creation instructions: [...]
   The new location value is always greater than the current one."
      

The first quotation implies that a CFI cannot describe a target
address outside of the enclosing FDE's range.

      

rdar://problem/26244988


Repository:
  rL LLVM

https://reviews.llvm.org/D32246

Files:
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  test/CodeGen/PowerPC/empty-functions.ll
  test/CodeGen/SPARC/empty-functions.ll
  test/CodeGen/X86/eh-frame-unreachable.ll
  test/CodeGen/X86/empty-functions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32246.95821.patch
Type: text/x-patch
Size: 4473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/a929fb9e/attachment.bin>


More information about the llvm-commits mailing list