public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Abstract ADDR_EXPR in match.pd
@ 2022-05-05 12:08 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-05 12:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c3d81987e9cf688740f267db19b35283a6baa71b

commit c3d81987e9cf688740f267db19b35283a6baa71b
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Apr 11 17:44:24 2022 +0100

    Abstract ADDR_EXPR in match.pd
    
    Mechanically replace uses of “ADDR_EXPR” or “addr” in match.pd
    with a new (any_addr) expression.  Just “addr” might be a better
    name than “any_addr”, but it's only possible to use that if/once
    ADDR_EXPR is renamed and split.

Diff:
---
 gcc/match.pd | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 0ede0affc54..8ea22628a86 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -110,6 +110,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 		   TYPE_VECTOR_SUBPARTS (TREE_TYPE (@0)))
       && tree_nop_conversion_p (TREE_TYPE (type), TREE_TYPE (TREE_TYPE (@0))))))
 
+(match (any_addr) (ADDR_EXPR))
+
 /* Transform likes of (char) ABS_EXPR <(int) x> into (char) ABSU_EXPR <x>
    ABSU_EXPR returns unsigned absolute value of the operand and the operand
    of the ABSU_EXPR will have the corresponding signed type.  */
@@ -1923,26 +1925,26 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* Try folding difference of addresses.  */
 (simplify
- (minus (convert ADDR_EXPR@0) (convert @1))
+ (minus (convert any_addr@0) (convert @1))
  (if (tree_nop_conversion_p (type, TREE_TYPE (@0)))
   (with { poly_int64 diff; }
    (if (ptr_difference_const (@0, @1, &diff))
     { build_int_cst_type (type, diff); }))))
 (simplify
- (minus (convert @0) (convert ADDR_EXPR@1))
+ (minus (convert @0) (convert any_addr@1))
  (if (tree_nop_conversion_p (type, TREE_TYPE (@0)))
   (with { poly_int64 diff; }
    (if (ptr_difference_const (@0, @1, &diff))
     { build_int_cst_type (type, diff); }))))
 (simplify
- (pointer_diff (convert?@2 ADDR_EXPR@0) (convert1?@3 @1))
+ (pointer_diff (convert?@2 any_addr@0) (convert1?@3 @1))
  (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0))
       && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1)))
   (with { poly_int64 diff; }
    (if (ptr_difference_const (@0, @1, &diff))
     { build_int_cst_type (type, diff); }))))
 (simplify
- (pointer_diff (convert?@2 @0) (convert1?@3 ADDR_EXPR@1))
+ (pointer_diff (convert?@2 @0) (convert1?@3 any_addr@1))
  (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0))
       && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1)))
   (with { poly_int64 diff; }
@@ -4502,7 +4504,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (for cmp (eq ne)
  (simplify
   /* SSA names are canonicalized to 2nd place.  */
-  (cmp addr@0 SSA_NAME@1)
+  (cmp any_addr@0 SSA_NAME@1)
   (with
    { poly_int64 off; tree base; }
    /* A local variable can never be pointed to by
@@ -4554,7 +4556,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (cmp @0 (bit_xor @1 (convert @2)))))
 
  (simplify
-  (cmp (convert? addr@0) integer_zerop)
+  (cmp (convert? any_addr@0) integer_zerop)
   (if (tree_single_nonzero_warnv_p (@0, NULL))
    { constant_boolean_node (cmp == NE_EXPR, type); }))
 
@@ -4651,7 +4653,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    enough to make fold_stmt not regress when not dispatching to fold_binary.  */
 (for cmp (simple_comparison)
  (simplify
-  (cmp (convert1?@2 addr@0) (convert2? addr@1))
+  (cmp (convert1?@2 any_addr@0) (convert2? any_addr@1))
   (with
    {
      poly_int64 off0, off1;


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

only message in thread, other threads:[~2022-05-05 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 12:08 [gcc(refs/vendors/ARM/heads/morello)] Abstract ADDR_EXPR in match.pd 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).