public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: Make get_value_for_expr check for INTEGER_CSTs
Date: Wed, 18 Sep 2019 06:54:00 -0000	[thread overview]
Message-ID: <mptr24e14d1.fsf@arm.com> (raw)

CONSTANT lattice values are symbolic constants rather than
compile-time constants, so among other things can be POLY_INT_CSTs.
This patch fixes a case in which we assumed all CONSTANTs were either
ADDR_EXPRs or INTEGER_CSTs.

This is tested by later SVE patches.

Tested on aarch64-linux-gnu with SVE (with and without follow-on
patches) and x86_64-linux-gnu.  OK to install?

Richard


2019-09-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-ssa-ccp.c (get_value_for_expr): Check whether CONSTANTs
	are INTEGER_CSTs.

Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c	2019-08-21 14:58:05.999057076 +0100
+++ gcc/tree-ssa-ccp.c	2019-09-18 07:53:36.930481545 +0100
@@ -615,9 +615,17 @@ get_value_for_expr (tree expr, bool for_
 	  val.mask = -1;
 	}
       if (for_bits_p
-	  && val.lattice_val == CONSTANT
-	  && TREE_CODE (val.value) == ADDR_EXPR)
-	val = get_value_from_alignment (val.value);
+	  && val.lattice_val == CONSTANT)
+	{
+	  if (TREE_CODE (val.value) == ADDR_EXPR)
+	    val = get_value_from_alignment (val.value);
+	  else if (TREE_CODE (val.value) != INTEGER_CST)
+	    {
+	      val.lattice_val = VARYING;
+	      val.value = NULL_TREE;
+	      val.mask = -1;
+	    }
+	}
       /* Fall back to a copy value.  */
       if (!for_bits_p
 	  && val.lattice_val == VARYING

             reply	other threads:[~2019-09-18  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  6:54 Richard Sandiford [this message]
2019-09-18  9:01 ` Richard Biener

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=mptr24e14d1.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@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).