Disable special put args for LIMIT_CALLER on x86.
authorPat Gavlin <pagavlin@microsoft.com>
Thu, 8 Dec 2016 22:14:38 +0000 (14:14 -0800)
committerPat Gavlin <pagavlin@microsoft.com>
Thu, 8 Dec 2016 22:14:38 +0000 (14:14 -0800)
commit5fa2fdaae5d261a14d30c5edec09dc289f1fa954
tree34de9ccdd11d4b3546873261faa404cbaa37a392
parent311d013bccddd0417a9ed293c90e8034df4d159c
Disable special put args for LIMIT_CALLER on x86.

On x86, `LSRA_LIMIT_CALLER` is too restrictive to allow the use of special
put args: this stress mode leaves only three registers allocatable--eax,
ecx, and edx--of which the latter two are also used for the first two
integral arguments to a call. This can leave us with too few registers to
succesfully allocate in situations like the following:

    t1026 =    lclVar    ref    V52 tmp35        u:3 REG NA <l:$3a1, c:$98d>

            /--*  t1026  ref
    t1352 = *  putarg_reg ref    REG NA

     t342 =    lclVar    int    V14 loc6         u:4 REG NA $50c

     t343 =    const     int    1 REG NA $41

            /--*  t342   int
            +--*  t343   int
     t344 = *  +         int    REG NA $495

     t345 =    lclVar    int    V04 arg4         u:2 REG NA $100

            /--*  t344   int
            +--*  t345   int
     t346 = *  %         int    REG NA $496

            /--*  t346   int
    t1353 = *  putarg_reg int    REG NA

    t1354 =    lclVar    ref    V52 tmp35         (last use) REG NA

            /--*  t1354  ref
    t1355 = *  lea(b+0)  byref  REG NA

Here, the first `putarg_reg` would normally be considered a special put arg,
which would remove `ecx` from the set of allocatable registers, leaving
only `eax` and `edx`. The allocator will then fail to allocate a register
for the def of `t345` if arg4 is not a register candidate: the corresponding
ref position will be constrained to { `ecx`, `ebx`, `esi`, `edi` }, which
`LSRA_LIMIT_CALLER` will further constrain to `ecx`, which will not be
available due to the special put arg.

Commit migrated from https://github.com/dotnet/coreclr/commit/53f78db5a1a12666f40b1648dbeb4d0c34a99415
src/coreclr/src/jit/lsra.cpp