From fa6e55f9f5e5f21ac53fcac10bd69218b73961c7 Mon Sep 17 00:00:00 2001 From: spop Date: Wed, 26 May 2010 16:46:25 +0000 Subject: [PATCH] Avoid if-conversion of loops in which the data dependence analysis fails. 2010-05-26 Sebastian Pop * tree-if-conv.c (if_convertible_loop_p): Avoid if-conversion of loops in which the data dependence analysis fails. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159883 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-if-conv.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cef95f2dde76..6a4bac37677f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-05-26 Sebastian Pop + + * tree-if-conv.c (if_convertible_loop_p): Avoid if-conversion + of loops in which the data dependence analysis fails. + 2010-05-26 Sebastian Pop * tree-if-conv.c (if_convertible_loop_p): Do not compute/free diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 23d71a044cf0..f5247a35ee79 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -623,6 +623,20 @@ if_convertible_loop_p (struct loop *loop) return false; } + /* Don't if-convert the loop when the data dependences cannot be + computed: the loop won't be vectorized in that case. */ + { + VEC (data_reference_p, heap) *refs = VEC_alloc (data_reference_p, heap, 5); + VEC (ddr_p, heap) *ddrs = VEC_alloc (ddr_p, heap, 25); + bool res = compute_data_dependences_for_loop (loop, true, &refs, &ddrs); + + free_data_refs (refs); + free_dependence_relations (ddrs); + + if (!res) + return false; + } + calculate_dominance_info (CDI_DOMINATORS); /* Allow statements that can be handled during if-conversion. */ -- 2.47.2