From ed4fd957296b0633d21996a9c4cd5a5f3a2ee2ba Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 19 Sep 2016 06:54:10 +0000 Subject: [PATCH] re PR tree-optimization/77514 (ICE in VN_INFO_GET, at tree-ssa-sccvn.c:406 w/ -O2 (and above)) 2016-09-19 Richard Biener PR tree-optimization/77514 * tree-ssa-pre.c (create_expression_by_pieces): Optimize search for folded stmt. From-SVN: r240226 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-pre.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8eecbfe..e48f844 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-19 Richard Biener + + PR tree-optimization/77514 + * tree-ssa-pre.c (create_expression_by_pieces): Optimize + search for folded stmt. + 2016-09-17 Jan Hubicka * passes.def (pass_early_thread_jumps): Schedule after forwprop. diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index d1fe72c..0c6f820 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2881,13 +2881,16 @@ create_expression_by_pieces (basic_block block, pre_expr expr, } /* Likewise if we simplified to sth not queued for insertion. */ bool found = false; - gsi = gsi_start (forced_stmts); - for (; !gsi_end_p (gsi); gsi_next (&gsi)) + gsi = gsi_last (forced_stmts); + for (; !gsi_end_p (gsi); gsi_prev (&gsi)) { gimple *stmt = gsi_stmt (gsi); tree forcedname = gimple_get_lhs (stmt); if (forcedname == folded) - found = true; + { + found = true; + break; + } } if (! found) { -- 2.7.4