public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3276] tree-optimization/97089 - fix bogus unsigned division replacement
@ 2020-09-18  8:12 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-09-18  8:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0f6150a5d368fc30540dac31e29f1d6d40f207d3

commit r11-3276-g0f6150a5d368fc30540dac31e29f1d6d40f207d3
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Sep 18 09:22:57 2020 +0200

    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  <rguenther@suse.de>
    
            PR tree-optimization/97089
            * tree-ssa-sccvn.c (visit_nary_op): Do not replace unsigned
            divisions.

Diff:
---
 gcc/tree-ssa-sccvn.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-18  8:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  8:12 [gcc r11-3276] tree-optimization/97089 - fix bogus unsigned division replacement Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).