diff options
author | Liqiang Tao <taolq@outlook.com> | 2022-09-16 22:15:15 +0800 |
---|---|---|
committer | Liqiang Tao <taolq@outlook.com> | 2022-09-16 22:24:46 +0800 |
commit | 2e37557fdeed381e8e790e20702ededb13c9cef3 (patch) | |
tree | 3179a30cf820f7915d1cbc75b6cb4b3e4b73c19c /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 1b445cada51e247116ef934c3394bcc6f22589f7 (diff) | |
download | llvm-2e37557fdeed381e8e790e20702ededb13c9cef3.zip llvm-2e37557fdeed381e8e790e20702ededb13c9cef3.tar.gz llvm-2e37557fdeed381e8e790e20702ededb13c9cef3.tar.bz2 |
StackProtector: ensure stack checks are inserted before the tail call
The IR stack protector pass should insert stack checks before the tail
calls not only the musttail calls. So that the attributes `ssqreq` and
`tail call`, which are emited by llvm-opt, could be both enabled by
llvm-llc.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D133860
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 510a8e3..ff828f5 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -471,18 +471,18 @@ bool StackProtector::InsertStackProtectors() { // instrumentation has already been generated. HasIRCheck = true; - // If we're instrumenting a block with a musttail call, the check has to be + // If we're instrumenting a block with a tail call, the check has to be // inserted before the call rather than between it and the return. The - // verifier guarantees that a musttail call is either directly before the + // verifier guarantees that a tail call is either directly before the // return or with a single correct bitcast of the return value in between so // we don't need to worry about many situations here. Instruction *CheckLoc = RI; Instruction *Prev = RI->getPrevNonDebugInstruction(); - if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isMustTailCall()) + if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isTailCall()) CheckLoc = Prev; else if (Prev) { Prev = Prev->getPrevNonDebugInstruction(); - if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isMustTailCall()) + if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isTailCall()) CheckLoc = Prev; } |