Merge pull request #7806 from sandreenko/fix-VSO-278365
authorsandreenko <seandree@microsoft.com>
Wed, 26 Oct 2016 05:32:11 +0000 (22:32 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Oct 2016 05:32:11 +0000 (22:32 -0700)
RyuJIT/x86: fix VSO 278365

1  2 
src/jit/morph.cpp

diff --combined src/jit/morph.cpp
@@@ -204,6 -204,9 +204,9 @@@ GenTreePtr Compiler::fgMorphCast(GenTre
                  {
                      case TYP_INT:
  #ifdef _TARGET_X86_ // there is no rounding convert to integer instruction on ARM or x64 so skip this
+ #ifdef LEGACY_BACKEND
+                         // the RyuJIT backend does not use the x87 FPU and therefore
+                         // does not support folding the cast conv.i4(round.d(d))
                          if ((oper->gtOper == GT_INTRINSIC) &&
                              (oper->gtIntrinsic.gtIntrinsicId == CORINFO_INTRINSIC_Round))
                          {
                              return fgMorphTree(oper);
                          }
                          // if SSE2 is not enabled, we need the helper
-                         else if (!opts.compCanUseSSE2)
+                         else
+ #endif // LEGACY_BACKEND
+                             if (!opts.compCanUseSSE2)
                          {
                              return fgMorphCastIntoHelper(tree, CORINFO_HELP_DBL2INT, oper);
                          }
@@@ -14339,15 -14344,7 +14344,15 @@@ GenTreePtr Compiler::fgRecognizeAndMorp
                  tree->gtOp.gtOp1 = rotatedValue;
                  tree->gtOp.gtOp2 = rotateIndex;
                  tree->ChangeOper(rotateOp);
 -                noway_assert(inputTreeEffects == ((rotatedValue->gtFlags | rotateIndex->gtFlags) & GTF_ALL_EFFECT));
 +
 +                unsigned childFlags = 0;
 +                for (GenTree* op : tree->Operands())
 +                {
 +                    childFlags |= (op->gtFlags & GTF_ALL_EFFECT);
 +                }
 +
 +                // The parent's flags should be a superset of its operands' flags
 +                noway_assert((inputTreeEffects & childFlags) == childFlags);
              }
              else
              {