diff mbox

[3/n] Remove GENERIC stmt combining from SCCVN

Message ID alpine.LSU.2.11.1506251519550.26650@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener June 25, 2015, 1:21 p.m. UTC
This allows (p + 1) + 2 to be combined to p + 3 (also a good sign
on why that single_use stuff is "bad" - bad in case we have restricted
simplifications to a single stmt as result anyway).

This shows up in gcc.dg/20020415-1.c (and more places)

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2015-06-25  Richard Biener  <rguenther@suse.de>

	* match.pd: Allow (p +p off1) +p off2 to (p +p (off1 + off2))
	irrespective on whether the inner operation has a single use
	of both off are constant.
diff mbox

Patch

Index: gcc/match.pd
===================================================================
--- gcc/match.pd	(revision 224893)
+++ gcc/match.pd	(working copy)
@@ -503,7 +520,8 @@  (define_operator_list swapped_tcc_compar
 /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)).  */
 (simplify
   (pointer_plus (pointer_plus@2 @0 @1) @3)
-  (if (single_use (@2))
+  (if (single_use (@2)
+       || (TREE_CODE (@1) == INTEGER_CST && TREE_CODE (@3) == INTEGER_CST))
    (pointer_plus @0 (plus @1 @3))))
 
 /* Pattern match