[2/6] Fix TYPE_PRECISION use in hashable_expr_equal_p

Message ID 20230623082704.5D4AB1331F@imap2.suse-dmz.suse.de
State Accepted
Headers
Series [1/6] Avoid shorten_binary_op on VECTOR_TYPE |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Richard Biener June 23, 2023, 8:27 a.m. UTC
  While the checks look unnecessary they probably are quick and
thus done early.  The following avoids using TYPE_PRECISION
on VECTOR_TYPEs by making the code match the comment which
talks about precision and signedness.  An alternative would
be to only retain the ERROR_MARK and TYPE_MODE checks or
use TYPE_PRECISION_RAW (but I like that least).

Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, OK?

	* tree-ssa-scopedtables.cc (hashable_expr_equal_p):
	Use element_precision.
---
 gcc/tree-ssa-scopedtables.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law June 23, 2023, 2:49 p.m. UTC | #1
On 6/23/23 02:27, Richard Biener via Gcc-patches wrote:
> While the checks look unnecessary they probably are quick and
> thus done early.  The following avoids using TYPE_PRECISION
> on VECTOR_TYPEs by making the code match the comment which
> talks about precision and signedness.  An alternative would
> be to only retain the ERROR_MARK and TYPE_MODE checks or
> use TYPE_PRECISION_RAW (but I like that least).
> 
> Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, OK?
> 
> 	* tree-ssa-scopedtables.cc (hashable_expr_equal_p):
> 	Use element_precision.
OK.
jeff
  

Patch

diff --git a/gcc/tree-ssa-scopedtables.cc b/gcc/tree-ssa-scopedtables.cc
index 528ddf2a2ab..e698ef97343 100644
--- a/gcc/tree-ssa-scopedtables.cc
+++ b/gcc/tree-ssa-scopedtables.cc
@@ -574,7 +574,7 @@  hashable_expr_equal_p (const struct hashable_expr *expr0,
       && (TREE_CODE (type0) == ERROR_MARK
 	  || TREE_CODE (type1) == ERROR_MARK
 	  || TYPE_UNSIGNED (type0) != TYPE_UNSIGNED (type1)
-	  || TYPE_PRECISION (type0) != TYPE_PRECISION (type1)
+	  || element_precision (type0) != element_precision (type1)
 	  || TYPE_MODE (type0) != TYPE_MODE (type1)))
     return false;