Fix to Jit32 test b46659.exe failure.
authorVenkata Sivaramakrishna Ramadugu <sivarv@microsoft.com>
Wed, 18 May 2016 17:59:02 +0000 (10:59 -0700)
committerVenkata Sivaramakrishna Ramadugu <sivarv@microsoft.com>
Wed, 18 May 2016 17:59:02 +0000 (10:59 -0700)
commit73d739f21839f9ddf165576d90d1b9a2a2ef5e4e
tree67c7297b886e8f6119248ee86de8f6f7716e7aa9
parent423c35aec8f6f392c6f24cfd03025900255d913d
Fix to Jit32 test b46659.exe  failure.

Here is the git hub issue: https://github.com/dotnet/coreclr/issues/4547

The repro case is

     i = -111
     while ( i > 0)
     {
         // another nested loop goes here
     }
     return 100

     After assertionProp, due to while loop condition lot of blocks/stmts get deleted as unreachable but optLoopCount is never decremented.  Later when optLoopCodeMotion() gets called, it iterates through optLoopTable[] and tries to access head

     if  ((loopRmv & loopBit)     ||
            tail == 0               ||
            head->bbTreeList == 0    )

     Since entire method reduces to a single basic block, head will be nullptr and accessing head->bbTreeList is leading to an AV.

     Fix: As a safe fix for RTM, also check whether head is nullptr.

[tfs-changeset: 1605919]

Commit migrated from https://github.com/dotnet/coreclr/commit/3bb9ddf1c6318655d9e6f46f29af02e0648fcebc
src/coreclr/tests/x86_jit32_issues.targets