Fix method and basic block flags used by early opts. (#2126)
authorEugene Rozenfeld <erozen@microsoft.com>
Mon, 27 Jan 2020 20:03:06 +0000 (12:03 -0800)
committerGitHub <noreply@github.com>
Mon, 27 Jan 2020 20:03:06 +0000 (12:03 -0800)
commitfad9312a238849018a26c1d11480a91e1f5d58e1
tree407b5b375dce4a544cd41b6b18db5804be98b5cd
parent9023aa2ecca472c66b6c3c4af5aafeec5c7a97ea
Fix method and basic block flags used by early opts. (#2126)

Fix method and basic block flags used by early opts.

Add missing BBF_HAS_NULLCHECK in loop test transformation.
This change had no diffs in frameworks and benchmark.

Add missing OMF_HAS_ARRAYREF and BBF_HAS_IDX_LEN in many places.
This change had diffs in frameworks and benchmark since the optimization
replacing GT_ARRLENGTH with a constant fires much more often.

Fix inlining to not lose basic block flags when the inlinee basic block
has a ret expr but no statements.

Change propGetType condition in optDoEarlyPropForFunc to check for OMF_HAS_NEWARRAY
in addition to OMF_HAS_NEWOBJ.

Check that methods and basic blocks that have calls to object allocation
helpers have OMF_HAS_NEWOBJ and BBF_HAS_NEWOBJ set.

Check that methods and basic blocks that have calls to array allocation
helpers have OMF_HAS_NEWARRAY and BBF_HAS_NEWARRAY set.

Check that methods and basic blocks that have GT_NULLCHECK nodes
helpers have OMF_HAS_NULLCHECK and BBF_HAS_NULLCHECK set.

Check that methods and basic blocks that access MethodTable
via GT_IND on a ref have OMF_HAS_VTABLEREF and BBF_HAS_VTABLEREF set.

Check that methods and basic blocks that have GT_ARRLENGTH
have OMF_HAS_ARRAYREF and BBF_HAS_IDX_LEN set.

Fix fgOptWhileLoop that could lose BBF_HAS_NEWOBJ and BBF_HAS_NEWARRAY.

Add asserts to make sure we don't have diverging codegen
in debug/checked/release because of early opts.

Add BBF_HAS_VTABREF to BBF_COMPACT_UPD and BBF_SPLIT_GAINED.
12 files changed:
src/coreclr/src/jit/block.h
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/compiler.hpp
src/coreclr/src/jit/earlyprop.cpp
src/coreclr/src/jit/flowgraph.cpp
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/loopcloning.cpp
src/coreclr/src/jit/loopcloning.h
src/coreclr/src/jit/morph.cpp
src/coreclr/src/jit/optimizer.cpp
src/coreclr/src/jit/simd.cpp