summaryrefslogtreecommitdiff
path: root/src/jit/gentree.h
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-10-09 16:57:03 +0000
committerGitHub <noreply@github.com>2018-10-09 16:57:03 +0000
commitfe00e42185494bb7f27590909d5013b3fc3bbfa7 (patch)
tree59b8ac16849d1d24d43a1ae03eaddac868358c22 /src/jit/gentree.h
parent20cbebbeb151acf901d686dc6beb3a51435edd3d (diff)
parent649d6653ca36f39cfa50cdd92c9efc7f319e24bc (diff)
downloadcoreclr-fe00e42185494bb7f27590909d5013b3fc3bbfa7.tar.gz
coreclr-fe00e42185494bb7f27590909d5013b3fc3bbfa7.tar.bz2
coreclr-fe00e42185494bb7f27590909d5013b3fc3bbfa7.zip
Merge pull request #20078 from CarolEidt/Fix20063
Handle partial multireg COPY
Diffstat (limited to 'src/jit/gentree.h')
-rw-r--r--src/jit/gentree.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index 3fecf008a6..ebeae48cc0 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -5524,22 +5524,25 @@ struct GenTreeCopyOrReload : public GenTreeUnOp
unsigned GetRegCount()
{
- if (gtRegNum == REG_NA)
- {
- return 0;
- }
#if FEATURE_MULTIREG_RET
- for (unsigned i = 0; i < MAX_RET_REG_COUNT - 1; ++i)
+ // We need to return the highest index for which we have a valid register.
+ // Note that the gtOtherRegs array is off by one (the 0th register is gtRegNum).
+ // If there's no valid register in gtOtherRegs, gtRegNum must be valid.
+ // Note that for most nodes, the set of valid registers must be contiguous,
+ // but for COPY or RELOAD there is only a valid register for the register positions
+ // that must be copied or reloaded.
+ //
+ for (unsigned i = MAX_RET_REG_COUNT; i > 1; i--)
{
- if (gtOtherRegs[i] == REG_NA)
+ if (gtOtherRegs[i - 2] != REG_NA)
{
- return i + 1;
+ return i;
}
}
- return MAX_RET_REG_COUNT;
-#else
- return 1;
#endif
+ // We should never have a COPY or RELOAD with no valid registers.
+ assert(gtRegNum != REG_NA);
+ return 1;
}
GenTreeCopyOrReload(genTreeOps oper, var_types type, GenTree* op1) : GenTreeUnOp(oper, type, op1)