diff options
author | Carol Eidt <carol.eidt@microsoft.com> | 2016-12-14 13:58:11 -0800 |
---|---|---|
committer | Carol Eidt <carol.eidt@microsoft.com> | 2016-12-14 13:58:11 -0800 |
commit | 910b2b6d2eb76fb94eca4a2ce2561e9c4270f849 (patch) | |
tree | 9ff9f1913e3e873e3eb4275e25599886448c5967 /src/jit | |
parent | deb75b4f815fd4d86ad444d19eec50f0f869f994 (diff) | |
download | coreclr-910b2b6d2eb76fb94eca4a2ce2561e9c4270f849.tar.gz coreclr-910b2b6d2eb76fb94eca4a2ce2561e9c4270f849.tar.bz2 coreclr-910b2b6d2eb76fb94eca4a2ce2561e9c4270f849.zip |
Correctly sequence fgMorphModToSubMulDiv
This method was creating a temp, but the final result was a GT_SUB with
a use of the temp as its op1, and it was not setting GTF_REVERSE_OPS.
This led to a liveness assert in LSRA.
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/morph.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index aef6029b16..4beebded5a 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -14054,8 +14054,16 @@ GenTree* Compiler::fgMorphModToSubMulDiv(GenTreeOp* tree) denominator = fgMakeMultiUse(&tree->gtOp2); } + // The numerator and denominator may have been assigned to temps, in which case + // their defining assignments are in the current tree. Therefore, we need to + // set the execuction order accordingly on the nodes we create. + // That is, the "mul" will be evaluated in "normal" order, and the "sub" must + // be set to be evaluated in reverse order. + // GenTree* mul = gtNewOperNode(GT_MUL, type, tree, gtCloneExpr(denominator)); + assert(!mul->IsReverseOp()); GenTree* sub = gtNewOperNode(GT_SUB, type, gtCloneExpr(numerator), mul); + sub->gtFlags |= GTF_REVERSE_OPS; #ifdef DEBUG sub->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED; |