From 11d6b45d431b0aa30cf5ce3941b01ba4fd342af5 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Thu, 25 May 2017 10:45:48 +0200 Subject: Allow some NOP conversions in (X+CST1)+CST2 in match.pd 2017-05-25 Marc Glisse gcc/ * match.pd ((A +- CST1) +- CST2): Allow some conversions. * tree.c (drop_tree_overflow): Handle COMPLEX_CST and VECTOR_CST. gcc/testsuite/ * gcc.dg/tree-ssa/addadd.c: New file. From-SVN: r248448 --- gcc/tree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index db31620..a58f9aa 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -13138,6 +13138,25 @@ drop_tree_overflow (tree t) and drop the flag. */ t = copy_node (t); TREE_OVERFLOW (t) = 0; + + /* For constants that contain nested constants, drop the flag + from those as well. */ + if (TREE_CODE (t) == COMPLEX_CST) + { + if (TREE_OVERFLOW (TREE_REALPART (t))) + TREE_REALPART (t) = drop_tree_overflow (TREE_REALPART (t)); + if (TREE_OVERFLOW (TREE_IMAGPART (t))) + TREE_IMAGPART (t) = drop_tree_overflow (TREE_IMAGPART (t)); + } + if (TREE_CODE (t) == VECTOR_CST) + { + for (unsigned i = 0; i < VECTOR_CST_NELTS (t); ++i) + { + tree& elt = VECTOR_CST_ELT (t, i); + if (TREE_OVERFLOW (elt)) + elt = drop_tree_overflow (elt); + } + } return t; } -- cgit v1.1