Restrict morph add rearrangement. (#23984)
authorEugene Rozenfeld <erozen@microsoft.com>
Wed, 17 Apr 2019 19:59:31 +0000 (12:59 -0700)
committerGitHub <noreply@github.com>
Wed, 17 Apr 2019 19:59:31 +0000 (12:59 -0700)
commitb0d17dc29f9a58a5580e8899ea8dae47c2d4c2aa
tree7183b2931ccf0c5e97c0272fc81cd6913fc1e001
parent176d0e108daa13b9503075a252ff19ef6d3b0a0c
Restrict morph add rearrangement. (#23984)

Morph has transformations
((x + const) + y) => ((x + y) + const)
and
((x + const1) + (y + const2)) => ((x + y) + (const1 + const2))

If x or y is a GC pointer and one of the int operands may be negative,
this may result in a byref temp that points outside of the ref object.
If the code is in a non-interruptible region and a GC happens, the byref
won't be updated.

This change disallows the transformations if one of the non-const
operands is a GC pointer.

Fixes #23792.
src/jit/morph.cpp
tests/src/JIT/Regression/JitBlue/GitHub_23792/GitHub_23792.il [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/GitHub_23792/GitHub_23792.ilproj [new file with mode: 0644]