You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/09/08 18:05:25 UTC

[GitHub] [tvm] comaniac commented on a change in pull request #8961: [Bugfix] Fix div zero error in rewrite_simplify

comaniac commented on a change in pull request #8961:
URL: https://github.com/apache/tvm/pull/8961#discussion_r704654334



##########
File path: tests/python/unittest/test_arith_rewrite_simplify.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+import py

Review comment:
       Not used?

##########
File path: src/arith/rewrite_simplify.cc
##########
@@ -474,6 +474,8 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const DivNode* op) {
     if ((div(ramp(b1, c1, lanes), broadcast(c2, lanes))).Match(ret)) {
       int64_t c1val = c1.Eval()->value;
       int64_t c2val = c2.Eval()->value;
+      // If divisor is equal to zero
+      ICHECK(c2val != 0) << "division by zero";

Review comment:
       nit: The check itself is clear enough so we probably don't need the comment.
   
   ```suggestion
         ICHECK(c2val != 0) << "division by zero";
   ```




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org