Skip to content

Commit

Permalink
Merge pull request #7050 from jdmpapin/ldiv-i2l-overflow
Browse files Browse the repository at this point in the history
Prevent ldiv/i2l -> i2l/idiv simplification when idiv could overflow
  • Loading branch information
vijaysun-omr authored Jul 1, 2023
2 parents 1872a0c + 9365a45 commit cf3a3a8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/optimizer/OMRSimplifierHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9046,6 +9046,8 @@ TR::Node *ldivSimplifier(TR::Node * node, TR::Block * block, TR::Simplifier * s)
firstChild = node->getFirstChild();
secondChild = node->getSecondChild();
if ((firstChild->getOpCodeValue() == TR::i2l) && (secondChild->getOpCodeValue() == TR::i2l) &&
// Make sure the generated idiv won't be able to overflow
(firstChild->isNonNegative() || secondChild->isNonNegative()) &&
performTransformation(s->comp(), "%sReduced ldiv [%p] of two i2l children to i2l of idiv \n", s->optDetailString(), node))
{
TR::TreeTop *curTree = s->_curTree;
Expand Down

0 comments on commit cf3a3a8

Please sign in to comment.