Factor signedness test into helper
authorJoseph Tremoulet <jotrem@microsoft.com>
Thu, 16 Feb 2017 19:45:52 +0000 (11:45 -0800)
committerJoseph Tremoulet <jotrem@microsoft.com>
Thu, 16 Feb 2017 19:45:52 +0000 (11:45 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/98492cf520a7e2af95a8344676f561795fedf230

src/coreclr/src/jit/gentree.h
src/coreclr/src/jit/optcse.cpp

index 0ea8321..eaca7a0 100644 (file)
@@ -1852,6 +1852,10 @@ public:
     {
         return (gtFlags & GTF_REVERSE_OPS) ? true : false;
     }
+    bool IsUnsigned() const
+    {
+        return ((gtFlags & GTF_UNSIGNED) != 0);
+    }
 
     inline bool IsCnsIntOrI() const;
 
index 06c96af..6b1c2bd 100644 (file)
@@ -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;