[PATCH] D61626: [RISCV] Disable tail call if the callee function contain __builtin_frame_address or __builtin_return_address
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 12:33:11 PDT 2019
mgrang added inline comments.
================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:1312
+// Return frame depth argument of __builtin_frame_address or
+// __builtin_return_address
+static unsigned getFrameDepthArg(const Instruction *I) {
----------------
Period at the end of comment.
================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:1415
+ const Function *CalleeFn = dyn_cast<Function>(G->getGlobal());
+ if (CalleeFn)
+ for (const BasicBlock &BB : *CalleeFn)
----------------
This check can be combined with the assignment:
if (const Function *CalleeFn = dyn_cast<Function>(G->getGlobal()))
================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:1419
+ if (isFrameAddressOrReturnAddressCall(&I) &&
+ (getFrameDepthArg(&I) > 0))
+ return false;
----------------
getFrameDepthArg asserts on isFrameAddressOrReturnAddressCall. So we end up calling isFrameAddressOrReturnAddressCall twice here. We could put them into one function but it is cleaner the way it is now.
@asb Do you think this should be cleaned up?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61626/new/
https://reviews.llvm.org/D61626
More information about the llvm-commits
mailing list