From 67763c7f980c515c89ceb8fb8fe045512f0daa4c Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 25 Oct 2018 14:03:24 +0000 Subject: [PATCH] 2018-10-25 Richard Biener * tree-if-conv.c: Include tree-ssa-sccvn.h. (tree_if_conversion): Run CSE on the if-converted loop body. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265489 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-if-conv.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 425c6202965..00ba522e439 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-10-25 Richard Biener + + * tree-if-conv.c: Include tree-ssa-sccvn.h. + (tree_if_conversion): Run CSE on the if-converted loop body. + 2018-10-25 Ilya Leoshkevich PR bootstrap/87747 diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 52aa5756c94..0ef7daa49e8 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -118,6 +118,7 @@ along with GCC; see the file COPYING3. If not see #include "cfganal.h" #include "internal-fn.h" #include "fold-const.h" +#include "tree-ssa-sccvn.h" /* Only handle PHIs with no more arguments unless we are asked to by simd pragma. */ @@ -2979,6 +2980,7 @@ tree_if_conversion (struct loop *loop) unsigned int todo = 0; bool aggressive_if_conv; struct loop *rloop; + bitmap exit_bbs; again: rloop = NULL; @@ -3056,6 +3058,14 @@ tree_if_conversion (struct loop *loop) /* Delete dead predicate computations. */ ifcvt_local_dce (loop->header); + /* Perform local CSE, this esp. helps the vectorizer analysis if loads + and stores are involved. + ??? We'll still keep dead stores though. */ + exit_bbs = BITMAP_ALLOC (NULL); + bitmap_set_bit (exit_bbs, single_exit (loop)->dest->index); + todo |= do_rpo_vn (cfun, loop_preheader_edge (loop), exit_bbs); + BITMAP_FREE (exit_bbs); + todo |= TODO_cleanup_cfg; cleanup: -- 2.11.4.GIT