From 07d8a2985e89fc3829467faff81f1c9dcb7e8138 Mon Sep 17 00:00:00 2001 From: Fei Peng Date: Wed, 13 Dec 2017 10:32:18 -0800 Subject: [PATCH] compare type size instead of var_types --- src/jit/importer.cpp | 6 +++--- src/jit/morph.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index 5396508..479384b 100644 --- a/src/jit/importer.cpp +++ b/src/jit/importer.cpp @@ -240,7 +240,7 @@ bool Compiler::impILConsumesAddr(const BYTE* codeAddr, CORINFO_METHOD_HANDLE fnc var_types lclTyp = JITtype2varType(info.compCompHnd->getFieldType(resolvedToken.hField, &clsHnd)); // Preserve 'small' int types - if (lclTyp > TYP_INT) + if (!varTypeIsSmall(lclTyp)) { lclTyp = genActualType(lclTyp); } @@ -13654,7 +13654,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) } /* Preserve 'small' int types */ - if (lclTyp > TYP_INT) + if (!varTypeIsSmall(lclTyp)) { lclTyp = genActualType(lclTyp); } @@ -13990,7 +13990,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) } /* Preserve 'small' int types */ - if (lclTyp > TYP_INT) + if (!varTypeIsSmall(lclTyp)) { lclTyp = genActualType(lclTyp); } diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 4265289..73883e5 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -12494,7 +12494,7 @@ DONE_MORPHING_CHILDREN: // castType is larger or the same as op1's type // then we can discard the cast. - if (varTypeIsSmall(castType) && (castType >= op1->TypeGet())) + if (varTypeIsSmall(castType) && (genTypeSize(castType) >= genTypeSize(op1->TypeGet()))) { tree->gtOp.gtOp2 = op2 = op2->gtCast.CastOp(); } @@ -14466,7 +14466,7 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree) /* Make sure these are all ints and precision is not lost */ - if (cast >= dstt && dstt <= TYP_INT && srct <= TYP_INT) + if (genTypeSize(cast) >= genTypeSize(dstt) && dstt <= TYP_INT && srct <= TYP_INT) { op2 = tree->gtOp2 = op2->gtCast.CastOp(); } -- 2.7.4