[PATCH] D61665: [TailCall] Disable tail call if the callee function contain __builtin_frame_address or __builtin_return_address

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 20:03:33 PDT 2019


shiva0217 created this revision.
Herald added subscribers: jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar, asb.
Herald added a project: LLVM.

Enabling tail call may remove the frame pointer and return address restoration in caller which will make the above two builtin functions get incorrect value if the depth parameter > 0.

E.g.

  void __attribute__((noinline)) *callee (char *p) {
      return __builtin_frame_address (1);
  }
  void *caller (void) {
      char * save = (char*) alloca (4);
      return callee (save);
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D61665

Files:
  lib/CodeGen/Analysis.cpp
  test/CodeGen/RISCV/builtin-frame-address.ll
  test/CodeGen/RISCV/builtin-return-address.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61665.198579.patch
Type: text/x-patch
Size: 6979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190508/e2d60036/attachment.bin>


More information about the llvm-commits mailing list