Jit: Fix SetIndirExceptionFlags.
authorEugene Rozenfeld <erozen@microsoft.com>
Fri, 4 Oct 2019 23:04:33 +0000 (16:04 -0700)
committerEugene Rozenfeld <erozen@microsoft.com>
Fri, 11 Oct 2019 01:52:26 +0000 (18:52 -0700)
commit45ca5446f2afcec0e1dda1f1ac4fe4963f0f4e06
tree2cd5e13f7eb656b6bf4f235a26710e750c46f00b
parente6c64c6178cc259bd461df0fd027f95f3139b54b
Jit: Fix SetIndirExceptionFlags.

SetIndirExceptionFlags should not set `GTF_IND_NONFAULTING` flag if the
address has `GTF_EXCEPT` flag.

The failing scenario was:

We were setting `GTF_IND_NONFAULTING` on this indirection (since `ADDR` Node
can't be null)

```
               [000003] *--XG-------              *  IND       int
               [000002] ---XG-------              \--*  ADDR      byref  Zero Fseq[i]
               [000001] ---XG-------                 \--*  FIELD     struct s
               [000000] ------------                    \--*  LCL_VAR   ref    V00 arg0
```
this was then transformed to

```
               [000003] *---G-------              *  IND       int
               [000013] -----+------              \--*  ADD       byref
               [000000] -----+------                 +--*  LCL_VAR   ref    V00 arg0
               [000012] -----+------                 \--*  CNS_INT   long   8 field offset Fseq[s, i]
```
The `GTF_EXCEPT` flag was cleared on `IND` because it had `GTF_IND_NONFAULTING`set
and the address no longer had  `GTF_EXCEPT` flag.

Fixes dotnet/coreclr#27027.

Commit migrated from https://github.com/dotnet/coreclr/commit/f58ce06e619e607d8e297d57f10afdc15cfce232
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/gentree.h
src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27027/GitHub_27027.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27027/GitHub_27027.csproj [new file with mode: 0644]