[PATCH] D133860: StackProtector: enable tail call optimization even without musttail

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 14:28:56 PDT 2022


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/StackProtector.cpp:485
       Prev = Prev->getPrevNonDebugInstruction();
-      if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isMustTailCall())
+      if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isTailCall())
         CheckLoc = Prev;
----------------
Are you sure this actually does the right thing?  Consider something like:

```
tail call void f()
call void g()
ret void
```

If I'm following correctly, we'll insert the guard before the call to f(), which seems wrong.

(The old code worked because a musttail call is always in tail position; a "tail" call is not.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133860/new/

https://reviews.llvm.org/D133860



More information about the llvm-commits mailing list