• V
    Optimizer should classify assignments to PseudoVariables as indirect assignments · a7169d18
    VSadov 提交于
    In a rare case incorrect classification may lead the optimizer to beleive it could get the RHS from the stack where in fact the stack will contain an LHS reference.
    
    Note that the condition when this woudl matter is extremely rare.
    - We need to have an LHS of an indirect assignment that is completely symbolic and not taking any arguments, indices, receivers, etc.. (otherwise we would arguments on the stack would prevent the bug from happening)
    PseudoVariable is one of such variables, (it is used only by EE at debug time)
    
    - We need two subsequent assignments of the same local targeting incorrectly classified variables.
    
    These conditions are not easily met, however we had a case where a pattern emitted by Deconstruction at debug time meeting these conditions and causing incorrect IL to happen.
    
    It is likely that the problem is temporary and will disappear after recent changes in Deconstruction codegen. However we still should not have the bug.
    
    I have
    1) changed classification of PseudoVariable assignments (in both C# and VB)
    2) Made classification exhaustive, so that asserts would be triggered if we need to analyse new assignment target.
    
    NOTE: I tried, but could not create a testcase that would not involve Deconstruction pattern (that is going away).
    It does not mean it is impossible, I just could not figure how.
    
    Fixes:#15425
    a7169d18
Optimizer.cs 76.7 KB