JIT: add a bit more importer folding (#16111)
authorAndy Ayers <andya@microsoft.com>
Wed, 31 Jan 2018 22:06:59 +0000 (14:06 -0800)
committerGitHub <noreply@github.com>
Wed, 31 Jan 2018 22:06:59 +0000 (14:06 -0800)
Eagerly fold expression trees for non-branch conditional operations.

Leads to elimination of boxes in some idiomatic uses. See notes and
examples in #14472.

src/jit/importer.cpp

index 0c7b560..4c3ea55 100644 (file)
@@ -12054,6 +12054,9 @@ void Compiler::impImportBlockCode(BasicBlock* block)
                     op1->gtFlags |= GTF_RELOP_NAN_UN | GTF_UNSIGNED;
                 }
 
+                // Fold result, if possible.
+                op1 = gtFoldExpr(op1);
+
                 impPushOnStack(op1, tiRetVal);
                 break;