From: Richard Biener Date: Fri, 18 Sep 2020 07:22:57 +0000 (+0200) Subject: tree-optimization/97089 - fix bogus unsigned division replacement X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f6150a5d368fc30540dac31e29f1d6d40f207d3;p=gcc.git tree-optimization/97089 - fix bogus unsigned division replacement This fixes bogus replacing of an unsigned (-x)/y division by -(x/y). 2020-09-18 Richard Biener PR tree-optimization/97089 * tree-ssa-sccvn.c (visit_nary_op): Do not replace unsigned divisions. --- diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 64f1e8c9160..014b7bdfd01 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -4824,8 +4824,11 @@ visit_nary_op (tree lhs, gassign *stmt) } } break; - case RDIV_EXPR: case TRUNC_DIV_EXPR: + if (TYPE_UNSIGNED (type)) + break; + /* Fallthru. */ + case RDIV_EXPR: case MULT_EXPR: /* Match up ([-]a){/,*}([-])b with v=a{/,*}b, replacing it with -v. */ if (! HONOR_SIGN_DEPENDENT_ROUNDING (type))