In general, a callee is free to use the scratch registers without
preserving its previous state. However, the VGPR used for SGPR
spilling can potentially have its inactive lanes overwritten by
the writelane instructions. When the function returns, it can
cause unexpected behavior if the VGPR value is not preserved
appropriately.
The current scheme to preserve the inactive lanes of such
scratch VGPRs is not done rightly. It preserves all lanes
and causes the outgoing values (if any) getting overwritten
by the epilog restores. It thus corrupts the return value.
To avoid such situations, this patch ensures we preserve only
the inactive lanes.
I'd rename IsCalleeSavedReg to EnableInactiveLanes