This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -5709,7 +5709,25 @@ bool Compiler::fgCanFastTailCall(GenTreeCall* callee)
5709
5709
if (argx->OperGet() == GT_LDOBJ)
5710
5710
{
5711
5711
#ifdef _TARGET_AMD64_
5712
- hasMultiByteArgs = !VarTypeIsMultiByteAndCanEnreg(TYP_STRUCT, argx->gtLdObj.gtClass, nullptr);
5712
+
5713
+ unsigned typeSize = 0;
5714
+ hasMultiByteArgs = !VarTypeIsMultiByteAndCanEnreg(TYP_STRUCT, argx->gtLdObj.gtClass, &typeSize);
5715
+
5716
+ #if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
5717
+ // On System V the args could be a 2 eightbyte struct that is passed in two registers.
5718
+ // Account for the second eightbyte in the nCalleeArgs.
5719
+ // TODO-CQ-Amd64-Unix: Structs of size between 9 to 16 bytes are conservatively estimated
5720
+ // as two args, since they need two registers. Whereas nCallerArgs is
5721
+ // counting such an arg as one.This would mean we will not be optimizing
5722
+ // certain calls though technically possible.
5723
+
5724
+ if (typeSize > TARGET_POINTER_SIZE)
5725
+ {
5726
+ unsigned extraArgRegsToAdd = (typeSize / TARGET_POINTER_SIZE);
5727
+ nCalleeArgs += extraArgRegsToAdd;
5728
+ }
5729
+ #endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
5730
+
5713
5731
#else
5714
5732
assert(!"Target platform ABI rules regarding passing struct type args in registers");
5715
5733
unreached();
You can’t perform that action at this time.
0 commit comments