summaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRenlin Li <renlin.li@arm.com>2018-10-15 16:49:05 +0000
committerRenlin Li <renlin@gcc.gnu.org>2018-10-15 16:49:05 +0000
commit4124119974fd87380de607a6bc9bfdcffe1702d8 (patch)
tree47feff0e7142f9546cb0f5127556626781cb82d4 /gcc/tree-vectorizer.c
parente60f68ec460bc5b33a6f75caac9667bf978f37d8 (diff)
[PR87563][AARCH64-SVE]: Don't keep ifcvt loop when COND_<OP> ifn could not be vectorized.
ifcvt will created versioned loop and it will permissively generate scalar COND_<OP> ifn. If in the loop vectorize pass, COND_<OP> could not get vectoized, the if-converted loop should be abandoned when the target doesn't support such ifn. gcc/ 2018-10-12 Renlin Li <renlin.li@arm.com> PR target/87563 * tree-vectorizer.c (try_vectorize_loop_1): Don't use if-conversioned loop when it contains ifn with types not supported by backend. * internal-fn.c (expand_direct_optab_fn): Add an assert. (direct_internal_fn_supported_p): New helper function. * internal-fn.h (direct_internal_fn_supported_p): Declare. gcc/testsuite/ 2018-10-12 Renlin Li <renlin.li@arm.com> PR target/87563 * gcc.target/aarch64/sve/pr87563.c: New. From-SVN: r265172
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 60ee7f6380c..12bf0fcd5bd 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -80,6 +80,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "gimple-pretty-print.h"
#include "opt-problem.h"
+#include "internal-fn.h"
/* Loop or bb location, with hotness information. */
@@ -899,23 +900,30 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
&& ! loop->inner)
{
basic_block bb = loop->header;
- bool has_mask_load_store = false;
+ bool require_loop_vectorize = false;
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
- if (is_gimple_call (stmt)
- && gimple_call_internal_p (stmt)
- && (gimple_call_internal_fn (stmt) == IFN_MASK_LOAD
- || gimple_call_internal_fn (stmt) == IFN_MASK_STORE))
+ gcall *call = dyn_cast <gcall *> (stmt);
+ if (call && gimple_call_internal_p (call))
{
- has_mask_load_store = true;
- break;
+ internal_fn ifn = gimple_call_internal_fn (call);
+ if (ifn == IFN_MASK_LOAD || ifn == IFN_MASK_STORE
+ /* Don't keep the if-converted parts when the ifn with
+ specifc type is not supported by the backend. */
+ || (direct_internal_fn_p (ifn)
+ && !direct_internal_fn_supported_p
+ (call, OPTIMIZE_FOR_SPEED)))
+ {
+ require_loop_vectorize = true;
+ break;
+ }
}
gimple_set_uid (stmt, -1);
gimple_set_visited (stmt, false);
}
- if (! has_mask_load_store && vect_slp_bb (bb))
+ if (!require_loop_vectorize && vect_slp_bb (bb))
{
dump_printf_loc (MSG_NOTE, vect_location,
"basic block vectorized\n");