[PATCH] D61626: [RISCV] 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
Mon May 6 23:09:51 PDT 2019
shiva0217 created this revision.
shiva0217 added reviewers: asb, apazos.
Herald added subscribers: benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar.
Herald added a project: LLVM.
Disable tail call if the callee function contain __builtin_frame_address or __builtin_return_address.
Otherwise, tail call optimization will remove the frame pointer and return address restoration which will make the above two builtin functions get incorrect value.
E.g.
void *callee (char *p) { return __builtin_return_address (1); }
void *caller (void) { char *save = (char*) alloca (4); return callee (save); }
Repository:
rL LLVM
https://reviews.llvm.org/D61626
Files:
lib/Target/RISCV/RISCVISelLowering.cpp
test/CodeGen/RISCV/builtin-frame-address.ll
test/CodeGen/RISCV/builtin-return-address.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61626.198397.patch
Type: text/x-patch
Size: 6802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/723e3cbf/attachment.bin>
More information about the llvm-commits
mailing list