[PATCH] D107872: [SimplifyLibCalls] propagate tail/musttail/notail flags on CallInsts

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 11:10:56 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2440
+      assert(NewCI->isMustTailCall() &&
+             "replaced musttail call with non-musttail call");
+      (void)NewCI;
----------------
I don't understand this assertion.  There are two possibilities for simplification:

1. We replace a call with some existing value.
2. We replace a call with another new call.

For (1), this assertion doesn't make sense: we don't have a call.  For (2), we probably can't safely do the replacement in general; musttail has a bunch of restrictions, and the replacement call might not satisfy them.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1162
 Value *LibCallSimplifier::optimizeMemPCpy(CallInst *CI, IRBuilderBase &B) {
+  if (CI->isMustTailCall())
+    return nullptr;
----------------
xbolva00 wrote:
> Is it worth it at all?
> 
> I would just bail out libcall simplifier for musttail CIs
I agree; musttail calls should be rare enough that it isn't a big deal to just skip libcall simplification completely


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107872



More information about the llvm-commits mailing list