From: Joseph Tremoulet Date: Thu, 16 Feb 2017 19:45:52 +0000 (-0800) Subject: Factor signedness test into helper X-Git-Tag: submit/tizen/20210909.063632~11030^2~8033^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1bf9d16bf7330fdd758a83a82c0092b491c089d9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Factor signedness test into helper Commit migrated from https://github.com/dotnet/coreclr/commit/98492cf520a7e2af95a8344676f561795fedf230 --- diff --git a/src/coreclr/src/jit/gentree.h b/src/coreclr/src/jit/gentree.h index 0ea8321..eaca7a0 100644 --- a/src/coreclr/src/jit/gentree.h +++ b/src/coreclr/src/jit/gentree.h @@ -1852,6 +1852,10 @@ public: { return (gtFlags & GTF_REVERSE_OPS) ? true : false; } + bool IsUnsigned() const + { + return ((gtFlags & GTF_UNSIGNED) != 0); + } inline bool IsCnsIntOrI() const; diff --git a/src/coreclr/src/jit/optcse.cpp b/src/coreclr/src/jit/optcse.cpp index 06c96af..6b1c2bd 100644 --- a/src/coreclr/src/jit/optcse.cpp +++ b/src/coreclr/src/jit/optcse.cpp @@ -783,7 +783,7 @@ void Compiler::updateCseArrLenMap(GenTreePtr compare) VNFuncApp cmpVNFuncApp; if (!vnStore->GetVNFunc(compareVN, &cmpVNFuncApp) || - (cmpVNFuncApp.m_func != GetVNFuncForOper(compare->OperGet(), (compare->gtFlags & GTF_UNSIGNED) != 0))) + (cmpVNFuncApp.m_func != GetVNFuncForOper(compare->OperGet(), compare->IsUnsigned()))) { // Value numbering inferred this compare as something other // than its own operator; leave its value number alone. @@ -809,12 +809,12 @@ void Compiler::updateCseArrLenMap(GenTreePtr compare) GenTreePtr op2 = compare->gtGetOp2(); vnStore->GetArrLenArithBoundInfo(compareVN, &info); - if (GetVNFuncForOper(op1->OperGet(), (op1->gtFlags & GTF_UNSIGNED) != 0) == info.arrOper) + if (GetVNFuncForOper(op1->OperGet(), op1->IsUnsigned()) == (VNFunc)info.arrOper) { // The arithmetic node is the array length's parent. arrLenParent = op1; } - else if (GetVNFuncForOper(op2->OperGet(), (op2->gtFlags & GTF_UNSIGNED) != 0) == info.arrOper) + else if (GetVNFuncForOper(op2->OperGet(), op2->IsUnsigned()) == (VNFunc)info.arrOper) { // The arithmetic node is the array length's parent. arrLenParent = op2;