guocju opened a new pull request, #18694:
URL: https://github.com/apache/tvm/pull/18694

   …loormod
   
   This patch fixes an issue in the LowerIntrin pass where incorrect 
optimizations were applied to floordiv and floormod operations.
   
   The root cause is that the pass attempts to find an equivalent 
representation for floordiv(a, b) by calculating the expression (op->b - 1) - 
a_min. This expression, when subjected to constant folding, can potentially 
overflow the range of int32 or int16. When this overflow occurs, the 
transformation becomes invalid and no longer equivalent to the original 
operation.
   
   To fix this, we enhanced the condition under which the transformation is 
applied. The new condition ensures that the transformation is only performed 
when (b_max - a_min) is less than INT_MAX + 2. If this condition is not met, 
the transformation is skipped and the common lowering steps are followed to 
ensure correctness.
   
   A regression test has been added to cover this case.
   
   Fixes #18684


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to