From a5c93f53874df217443c718dd5e938783e695871 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Tue, 8 Aug 2017 11:32:05 +0000 Subject: [PATCH] re PR tree-optimization/81744 (ICE: verify_ssa failed, at tree-ssa.c:1186) PR tree-optimization/81744 * tree-predcom.c (prepare_finalizers_chain): Deep copy expr of loop's number of iterations. gcc/testsuite * gcc.dg/tree-ssa/pr81744.c: New. From-SVN: r250950 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr81744.c | 13 +++++++++++++ gcc/tree-predcom.c | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr81744.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dde91ceea5b..d830fd65c12 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-08-08 Bin Cheng + + PR tree-optimization/81744 + * tree-predcom.c (prepare_finalizers_chain): Deep copy expr of + loop's number of iterations. + 2017-08-08 Martin Liska * asan.c: Include header files. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e08c2e848f4..211e629fda3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-08 Bin Cheng + + PR tree-optimization/81744 + * gcc.dg/tree-ssa/pr81744.c: New. + 2017-08-08 Marek Polacek PR c++/81607 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c new file mode 100644 index 00000000000..b0f5d38ff93 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-inline -fdump-tree-pcom-details" } */ + +typedef struct { + int a, b; +} CompandSegment; +int a; +CompandSegment *b; +void fn1() { + for (; a; a++) + b[a].a = b[a].b = b[a - 1].a = b[a - 1].b = 0; +} +/* { dg-final { scan-tree-dump-times "Store-stores chain" 2 "pcom"} } */ diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 4538773552c..e7b10cb390f 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -2940,7 +2940,7 @@ prepare_finalizers_chain (struct loop *loop, chain_p chain) if (TREE_CODE (niters) != INTEGER_CST && TREE_CODE (niters) != SSA_NAME) { - niters = copy_node (niters); + niters = unshare_expr (niters); niters = force_gimple_operand (niters, &stmts, true, NULL); if (stmts) { -- 2.30.2