public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/31178] VRP can infer a range for b in a >> b and a << b
Date: Thu, 15 Mar 2007 14:43:00 -0000	[thread overview]
Message-ID: <20070315144336.21305.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31178-10053@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-03-15 14:43 -------
This is blocked by the same fact as PR30317 in that ASSERT_EXPRs can only
assert half-ranges or single valued ranges.  This makes the following prototype
not assert [0, prec) but [-INF, prec) instead :(

Index: tree-vrp.c
===================================================================
*** tree-vrp.c  (revision 122953)
--- tree-vrp.c  (working copy)
*************** infer_value_range (tree stmt, tree op, e
*** 3113,3118 ****
--- 3113,3134 ----
        }
      }

+   /* We can assume that the shift argument of a left or right shift
+      is within zero and the type precision of the shifted operand.  */
+   if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
+       && (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == RSHIFT_EXPR
+         || TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == LSHIFT_EXPR)
+       && TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 1) == op)
+     {
+       tree lop = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0);
+       tree lop_type = TREE_TYPE (lop);
+ 
+       /* Unfortunately we only can infer half-ranges here.  */
+       *val_p = build_int_cst (lop_type, TYPE_PRECISION (lop_type) - 1);
+       *comp_code_p = LE_EXPR;
+       return true;
+     }
+ 
    return false;
  }



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |30317


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


  reply	other threads:[~2007-03-15 14:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14 21:13 [Bug tree-optimization/31178] New: " rguenth at gcc dot gnu dot org
2007-03-15 14:43 ` rguenth at gcc dot gnu dot org [this message]
2009-02-08 14:21 ` [Bug tree-optimization/31178] " steven at gcc dot gnu dot org
2009-02-08 14:47 ` rguenth at gcc dot gnu dot org
     [not found] <bug-31178-4@http.gcc.gnu.org/bugzilla/>
2013-02-11  7:48 ` rguenth at gcc dot gnu.org
2013-02-11  8:00 ` jakub at gcc dot gnu.org
2022-03-22 14:21 ` amacleod at redhat dot com
2022-03-22 17:03 ` amacleod at redhat dot com
2022-03-23  8:08 ` rguenther at suse dot de
2022-03-23  8:26 ` jakub at gcc dot gnu.org
2022-03-23  8:31 ` jakub at gcc dot gnu.org
2022-04-05 17:58 ` amacleod at redhat dot com
2022-04-05 18:06 ` jakub at gcc dot gnu.org
2022-04-05 18:24 ` amacleod at redhat dot com
2022-04-06  6:00 ` rguenth at gcc dot gnu.org
2022-04-06  8:16 ` vincent-gcc at vinc17 dot net
2022-04-06  8:22 ` rguenther at suse dot de
2022-04-06  8:45 ` vincent-gcc at vinc17 dot net
2022-04-06 13:10 ` amacleod at redhat dot com
2022-04-06 13:13 ` jakub at gcc dot gnu.org
2022-04-06 13:16 ` rguenther at suse dot de
2024-06-20 16:07 ` pinskia at gcc dot gnu.org
2024-06-26  5:44 ` pinskia 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=20070315144336.21305.qmail@sourceware.org \
    --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).