public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] verbosify unified nonconst merges
@ 2020-09-23 23:24 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2020-09-23 23:24 UTC (permalink / raw)
  To: gcc-cvs

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

commit b90d7a7ffa1fc32af74fdf09ba89e16a4def59ee
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Sep 17 09:46:56 2020 -0300

    verbosify unified nonconst merges

Diff:
---
 gcc/fold-const.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 52ac05f43a4..961e8954128 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6701,6 +6701,22 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
       ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask);
       lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask);
 
+      bool report
+	= (l_split_load
+	   || (!(lnbitsize == rnbitsize
+		 && xll_bitpos == xlr_bitpos
+		 && lnbitpos >= 0
+		 && rnbitpos >= 0)
+	       && !(((ll_bitsize + ll_bitpos == rl_bitpos
+		      && lr_bitsize + lr_bitpos == rr_bitpos)
+		     || (ll_bitpos == rl_bitpos + rl_bitsize
+			 && lr_bitpos == rr_bitpos + rr_bitsize))
+		    && ll_bitpos >= 0
+		    && rl_bitpos >= 0
+		    && lr_bitpos >= 0
+		    && rr_bitpos >= 0)));
+
+      tree orig_lhs = lhs, orig_rhs = rhs;
       lhs = make_bit_field_ref (loc, ll_inner, ll_arg,
 				lntype, lnbitsize, lnbitpos,
 				ll_unsignedp || rl_unsignedp, ll_reversep);
@@ -6750,7 +6766,16 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
       if (! integer_all_onesp (lr_mask))
 	rhs = build2_loc (loc, BIT_AND_EXPR, type, rhs, lr_mask);
 
-      return build2_loc (loc, wanted_code, truth_type, lhs, rhs);
+      result = build2_loc (loc, wanted_code, truth_type, lhs, rhs);
+
+      if (report)
+	inform (loc, "merged nc extra %qE and %qE into %qE",
+		orig_lhs, orig_rhs, result);
+      else if (l_xor || r_xor)
+	inform (loc, "merged extra %qE and %qE into %qE",
+		orig_lhs, orig_rhs, result);
+
+      return result;
     }
 
   /* Handle the case of comparisons with constants.  If there is something in


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] verbosify unified nonconst merges
@ 2020-09-17 13:46 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2020-09-17 13:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:139b006646d02d6a16d582714b44c897af682702

commit 139b006646d02d6a16d582714b44c897af682702
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Thu Sep 17 09:46:56 2020 -0300

    verbosify unified nonconst merges

Diff:
---
 gcc/fold-const.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c6cffb8ffcf..f901fad51b3 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6675,6 +6675,20 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
       ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask);
       lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask);
 
+      bool report =
+	!(lnbitsize == rnbitsize
+	  && xll_bitpos == xlr_bitpos
+	  && lnbitpos >= 0
+	  && rnbitpos >= 0)
+	&& !(((ll_bitsize + ll_bitpos == rl_bitpos
+	       && lr_bitsize + lr_bitpos == rr_bitpos)
+	      || (ll_bitpos == rl_bitpos + rl_bitsize
+		  && lr_bitpos == rr_bitpos + rr_bitsize))
+	     && ll_bitpos >= 0
+	     && rl_bitpos >= 0
+	     && lr_bitpos >= 0
+	     && rr_bitpos >= 0);
+
       lhs = make_bit_field_ref (loc, ll_inner, ll_arg,
 				lntype, lnbitsize, lnbitpos,
 				ll_unsignedp || rl_unsignedp, ll_reversep);
@@ -6724,7 +6738,16 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
       if (! integer_all_onesp (lr_mask))
 	rhs = build2_loc (loc, BIT_AND_EXPR, type, rhs, lr_mask);
 
-      return build2_loc (loc, wanted_code, truth_type, lhs, rhs);
+      result = build2_loc (loc, wanted_code, truth_type, lhs, rhs);
+
+      if (report)
+	inform (loc, "merged nc extra %qE and %qE into %qE",
+		lhs, rhs, result);
+      else if (l_xor || r_xor)
+	inform (loc, "merged extra %qE and %qE into %qE",
+		lhs, rhs, result);
+
+      return result;
     }
 
   /* Handle the case of comparisons with constants.  If there is something in


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-23 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 23:24 [gcc(refs/users/aoliva/heads/testme)] verbosify unified nonconst merges Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2020-09-17 13:46 Alexandre Oliva

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