public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/52298] ICE: verify_ssa failed: definition in block follows use
Date: Mon, 20 Feb 2012 13:48:00 -0000	[thread overview]
Message-ID: <bug-52298-4-rO6wMLBrk0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52298-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52298

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-20 13:41:59 UTC ---
DOM optimizes the |s with zero if you adjust the integer_..._p predicates like

Index: gcc/tree.c
===================================================================
--- gcc/tree.c  (revision 184390)
+++ gcc/tree.c  (working copy)
@@ -1714,12 +1714,25 @@ integer_zerop (const_tree expr)
 {
   STRIP_NOPS (expr);

-  return ((TREE_CODE (expr) == INTEGER_CST
-          && TREE_INT_CST_LOW (expr) == 0
-          && TREE_INT_CST_HIGH (expr) == 0)
-         || (TREE_CODE (expr) == COMPLEX_CST
-             && integer_zerop (TREE_REALPART (expr))
-             && integer_zerop (TREE_IMAGPART (expr))));
+  switch (TREE_CODE (expr))
+    {
+    case INTEGER_CST:
+      return (TREE_INT_CST_LOW (expr) == 0
+             && TREE_INT_CST_HIGH (expr) == 0);
+    case COMPLEX_CST:
+      return (integer_zerop (TREE_REALPART (expr))
+             && integer_zerop (TREE_IMAGPART (expr)));
+    case VECTOR_CST:
+      {
+       tree elt;
+       for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+         if (!integer_zerop (TREE_VALUE (elt)))
+           return false;
+       return true;
+      }
+    default:
+      return false;
+    }
 }

 /* Return 1 if EXPR is the integer constant one or the corresponding
@@ -1730,12 +1743,25 @@ integer_onep (const_tree expr)
 {
   STRIP_NOPS (expr);

-  return ((TREE_CODE (expr) == INTEGER_CST
-          && TREE_INT_CST_LOW (expr) == 1
-          && TREE_INT_CST_HIGH (expr) == 0)
-         || (TREE_CODE (expr) == COMPLEX_CST
-             && integer_onep (TREE_REALPART (expr))
-             && integer_zerop (TREE_IMAGPART (expr))));
+  switch (TREE_CODE (expr))
+    {
+    case INTEGER_CST:
+      return (TREE_INT_CST_LOW (expr) == 1
+             && TREE_INT_CST_HIGH (expr) == 0);
+    case COMPLEX_CST:
+      return (integer_onep (TREE_REALPART (expr))
+             && integer_zerop (TREE_IMAGPART (expr)));
+    case VECTOR_CST:
+      {
+       tree elt;
+       for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+         if (!integer_onep (TREE_VALUE (elt)))
+           return false;
+       return true;
+      }
+    default:
+      return false;
+    }
 }

 /* Return 1 if EXPR is an integer containing all 1's in as much precision as
@@ -1754,6 +1780,15 @@ integer_all_onesp (const_tree expr)
       && integer_zerop (TREE_IMAGPART (expr)))
     return 1;

+  else if (TREE_CODE (expr) == VECTOR_CST)
+    {
+      tree elt;
+      for (elt = TREE_VECTOR_CST_ELTS (expr); elt; elt = TREE_CHAIN (elt))
+       if (!integer_all_onesp (TREE_VALUE (elt)))
+         return 0;
+      return 1;
+    }
+
   else if (TREE_CODE (expr) != INTEGER_CST)
     return 0;


I'll queue that for 4.8.


  parent reply	other threads:[~2012-02-20 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 15:44 [Bug c/52298] New: " regehr at cs dot utah.edu
2012-02-18 10:24 ` [Bug tree-optimization/52298] " jakub at gcc dot gnu.org
2012-02-20  9:29 ` jakub at gcc dot gnu.org
2012-02-20 12:28 ` rguenth at gcc dot gnu.org
2012-02-20 13:48 ` rguenth at gcc dot gnu.org [this message]
2012-02-20 14:19 ` rguenth at gcc dot gnu.org
2012-02-20 15:19 ` rguenth at gcc dot gnu.org
2012-02-20 15:29 ` rguenth at gcc dot gnu.org
2012-02-29  1:44 ` uweigand at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52298-4-rO6wMLBrk0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).