Skip to content

Commit

Permalink
Code Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
briansull committed Feb 26, 2021
1 parent 34742e9 commit f101bb5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,17 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
{
oper = fgMorphCastIntoHelper(tree, CORINFO_HELP_LNG2DBL, oper);

// Since we don't have a Jit Helper that converts to a TYP_FLOAT
// we just use the one that converts to a TYP_DOUBLE
// and then add a cast to TYP_FLOAT
//
if ((dstType == TYP_FLOAT) && (oper->OperGet() == GT_CALL))
{
// oper is a helper call to CORINFO_HELP_LNG2DBL
// but fgMorphCastIntoHelper sets the return type wrong
// leading to problems if we try to CSE this call
// Fix the return type to be TYP_DOUBLE
//
oper->gtType = TYP_DOUBLE; // CORINFO_HELP_LNG2DBL actually returns a TYP_DOUBLE
oper->gtType = TYP_DOUBLE;

// Add a Cast to TYP_FLOAT, nop on x86 using FPU stack
// Add a Cast to TYP_FLOAT
//
tree = gtNewCastNode(TYP_FLOAT, oper, false, TYP_FLOAT);
INDEBUG(tree->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
Expand Down

0 comments on commit f101bb5

Please sign in to comment.