[llvm] [NFC ]Add a helper function isTailCall for getting libcall in SelectionDAG (PR #155256)

zhijian lin via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 09:04:27 PDT 2025


================
@@ -9012,6 +9012,14 @@ static void checkAddrSpaceIsValidForLibcall(const TargetLowering *TLI,
   }
 }
 
+static bool isTailCall(const CallInst *CI, const SelectionDAG *SelDAG,
+                       bool IsLowerToLibCall) {
+  bool ReturnsFirstArg = CI && funcReturnsFirstArgOfCall(*CI);
+  return CI && CI->isTailCall() &&
+         isInTailCallPosition(*CI, SelDAG->getTarget(),
+                              ReturnsFirstArg && IsLowerToLibCall);
----------------
diggerlin wrote:

thank you for your feedback, , I addressed part of your comment.  I’m not sure I fully understood your comment.

> we don't want to start tail calling where we didn't before in an NFC patch, but we can still clean this up a little. I suggest putting in a TODO: fix returns first arg determination

 Would you mind elaborating a bit more on what you mean here? In particular, I’d like to better understand the part about adding the TODO for fixing the return’s first argument determination.






https://github.com/llvm/llvm-project/pull/155256


More information about the llvm-commits mailing list