aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-11-10 16:06:47 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-11-10 16:06:47 +0000
commite639b20676a9eab048bfdcf007b7ab3b6398a845 (patch)
treeed8ed8365eea43b3d72b37435d34a18cb7900de2 /gcc/tree-if-conv.c
parent59e0c6b70fdb0c9683597f470d8f795b59812aa8 (diff)
downloadgcc-e639b20676a9eab048bfdcf007b7ab3b6398a845.zip
gcc-e639b20676a9eab048bfdcf007b7ab3b6398a845.tar.gz
gcc-e639b20676a9eab048bfdcf007b7ab3b6398a845.tar.bz2
Fix PR45971: do not predicate condition phi nodes that are scev analyzable.
2010-11-10 Sebastian Pop <sebastian.pop@amd.com> PR tree-optimization/45971 * tree-if-conv.c (predicate_scalar_phi): Do not generate a COND_EXPR for phi nodes analyzable by scev. * gcc.dg/vect/O3-pr45971.c: New. From-SVN: r166544
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 17b6672..fc65845 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1224,7 +1224,7 @@ predicate_scalar_phi (gimple phi, tree cond,
{
gimple new_stmt;
basic_block bb;
- tree rhs, res, arg;
+ tree rhs, res, arg, scev;
gcc_assert (gimple_code (phi) == GIMPLE_PHI
&& gimple_phi_num_args (phi) == 2);
@@ -1236,8 +1236,12 @@ predicate_scalar_phi (gimple phi, tree cond,
bb = gimple_bb (phi);
- arg = degenerate_phi_result (phi);
- if (arg)
+ if ((arg = degenerate_phi_result (phi))
+ || ((scev = analyze_scalar_evolution (gimple_bb (phi)->loop_father,
+ res))
+ && !chrec_contains_undetermined (scev)
+ && scev != res
+ && (arg = gimple_phi_arg_def (phi, 0))))
rhs = arg;
else
{