We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43dd0a7 commit dec0f8aCopy full SHA for dec0f8a
src/coreclr/jit/morph.cpp
@@ -13073,9 +13073,8 @@ GenTree* Compiler::fgOptimizeAddition(GenTreeOp* add)
13073
DEBUG_DESTROY_NODE(constTwo);
13074
}
13075
13076
- // Fold (x + 0) - given it won't change the tree type to TYP_REF.
13077
- // TODO-Bug: this code will lose the GC-ness of a tree like "native int + byref(0)".
13078
- if (op2->IsIntegralConst(0) && ((add->TypeGet() == op1->TypeGet()) || !op1->TypeIs(TYP_REF)))
+ // Fold (x + 0) - given it won't change the tree type.
+ if (op2->IsIntegralConst(0) && (genActualType(add) == genActualType(op1)))
13079
{
13080
if (op2->IsCnsIntOrI() && varTypeIsI(op1))
13081
0 commit comments