public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] vrp: Move INTEGRAL_TYPE_P test
@ 2022-05-13 15:43 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-13 15:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:57db681f6093ccbee6a5db4ba991682e77fcaf77

commit 57db681f6093ccbee6a5db4ba991682e77fcaf77
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Fri May 13 09:59:13 2022 +0100

    vrp: Move INTEGRAL_TYPE_P test
    
    register_edge_assert_for_2 was looking for a cast between
    integers of the same precision, but it tested for equal
    precisions before testing for an integer.
    
    (The context is an ordered comparison involving an INTEGER_CST,
    so the value being compared cannot be a capability.)

Diff:
---
 gcc/testsuite/gcc.target/aarch64/morello/vrp-1.c | 5 +++++
 gcc/tree-vrp.c                                   | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/morello/vrp-1.c b/gcc/testsuite/gcc.target/aarch64/morello/vrp-1.c
new file mode 100644
index 00000000000..8580abc0227
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/morello/vrp-1.c
@@ -0,0 +1,5 @@
+__intcap_t bar;
+int foo ()
+{
+  return ({ __builtin_expect(bar > 4096UL, 0) ?: bar; });
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index da0bb590458..64fc58c7e35 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1835,6 +1835,7 @@ register_edge_assert_for_2 (tree name, edge e,
       if (gimple_assign_cast_p (def_stmt))
 	{
 	  if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))
+	      && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
 	      && ! TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
 	      && (TYPE_PRECISION (gimple_expr_type (def_stmt))
 		  == TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))))
@@ -1845,8 +1846,7 @@ register_edge_assert_for_2 (tree name, edge e,
       if (name3 != NULL_TREE
       	  && TREE_CODE (name3) == SSA_NAME
 	  && (cst2 == NULL_TREE
-	      || TREE_CODE (cst2) == INTEGER_CST)
-	  && INTEGRAL_TYPE_P (TREE_TYPE (name3)))
+	      || TREE_CODE (cst2) == INTEGER_CST))
 	{
 	  tree tmp;


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

only message in thread, other threads:[~2022-05-13 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 15:43 [gcc(refs/vendors/ARM/heads/morello)] vrp: Move INTEGRAL_TYPE_P test Matthew Malcomson

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