[llvm] [AArch64][GlobalISel] Fix incorrect ABI when tail call not supported (PR #70215)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 15:10:47 PDT 2023


================
@@ -854,7 +854,10 @@ bool AArch64CallLowering::areCalleeOutgoingArgsTailCallable(
 
   AArch64OutgoingValueAssigner CalleeAssigner(AssignFnFixed, AssignFnVarArg,
                                               Subtarget, /*IsReturn*/ false);
-  if (!determineAssignments(CalleeAssigner, OutArgs, OutInfo)) {
+  // determineAssignments() may modify argument flags, so make a copy.
+  SmallVector<ArgInfo, 8> OutArgsCopy;
+  append_range(OutArgsCopy, OutArgs);
+  if (!determineAssignments(CalleeAssigner, OutArgsCopy, OutInfo)) {
     LLVM_DEBUG(dbgs() << "... Could not analyze call operands.\n");
     return false;
   }
----------------
erikdesjardins wrote:

> Just a boolean canDetermineAssignments() query wouldn't be enough for use in this function, we do need the result as well.

I interpret this to mean that the mutations performed by `determineAssignments` are necessary when this function succeeds.

But in that case, I would expect to see `*OutArgs = OutArgsCopy;` or similar at the end of this function?

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


More information about the llvm-commits mailing list