summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McKinsey <chrismck@microsoft.com>2015-03-28 11:21:51 -0700
committerChris McKinsey <chrismck@microsoft.com>2015-03-28 11:21:51 -0700
commit0711163b88aad01cf4b2ed442b7512e7e1a7ef31 (patch)
tree608a83164b5b3596e45f75a1b6cc28e770d06121
parent898cdcf05ae334252b354a1f5bae9e26be1912ec (diff)
downloadcoreclr-0711163b88aad01cf4b2ed442b7512e7e1a7ef31.tar.gz
coreclr-0711163b88aad01cf4b2ed442b7512e7e1a7ef31.tar.bz2
coreclr-0711163b88aad01cf4b2ed442b7512e7e1a7ef31.zip
Change null constant type to be TYP_REF for isinst nullcheck expansion
In the importer when inlining the fast expansion sequence for isinst/castclass, the code was typing the constant 0 source of the compare with TYP_I_IMPL instead of TYP_REF. Not only does this create an inconsistently typed compare but it causes value-numbering of the same constants with different types to not be equal. This blocks later assertion propagation that propagates null-checks and prevents many cases from being eliminated. This change changes the type of the constant gtNode to be TYP_REF. With this change there are many good diffs in the frameworks and other assemblies. Ran testing in desktop branch including SuperPMI asm diffs. Asm diffs show hundreds of methods with improvements in framework , Roslyn, and other internal assemblies. 1% code size reduction in the methods that have changes. All diffs are elimination of redundant null-checks.
-rw-r--r--src/jit/importer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 652231085f..d55710400b 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -8178,7 +8178,7 @@ GenTreePtr Compiler::impCastClassOrIsInstToTree(GenTreePtr op1, GenTreePtr op2,
// op1Copy CNS_INT
// null
//
- condNull = gtNewOperNode(GT_EQ, TYP_INT, gtClone(op1), gtNewIconNode(0, TYP_I_IMPL));
+ condNull = gtNewOperNode(GT_EQ, TYP_INT, gtClone(op1), gtNewIconNode(0, TYP_REF));
//
// expand the true and false trees for the condMT