In vectorizable_reduction, one check on a reduction operand via index could be
contained by another one check via pointer, so remove the former.
Thanks,
Feng
---
gcc/
* tree-vect-loop.cc (vectorizable_reduction): Remove the duplicated
check.
---
gcc/tree-vect-loop.cc | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d9a2ad69484..6e8b3639daf 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7815,11 +7815,9 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
"use not simple.\n");
return false;
}
- if (i == STMT_VINFO_REDUC_IDX (stmt_info))
- continue;
- /* For an IFN_COND_OP we might hit the reduction definition operand
- twice (once as definition, once as else). */
+ /* Skip reduction operands, and for an IFN_COND_OP we might hit the
+ reduction operand twice (once as definition, once as else). */
if (op.ops[i] == op.ops[STMT_VINFO_REDUC_IDX (stmt_info)])
continue;
--
2.17.1
From 5d2c22ad724856db12bf0ca568650f471447fa34 Mon Sep 17 00:00:00 2001
From: Feng Xue <f...@os.amperecomputing.com>
Date: Sun, 16 Jun 2024 12:08:56 +0800
Subject: [PATCH 2/8] vect: Remove duplicated check on reduction operand
In vectorizable_reduction, one check on a reduction operand via index could be
contained by another one check via pointer, so remove the former.
2024-06-16 Feng Xue <f...@os.amperecomputing.com>
gcc/
* tree-vect-loop.cc (vectorizable_reduction): Remove the duplicated
check.
---
gcc/tree-vect-loop.cc | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d9a2ad69484..6e8b3639daf 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7815,11 +7815,9 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
"use not simple.\n");
return false;
}
- if (i == STMT_VINFO_REDUC_IDX (stmt_info))
- continue;
- /* For an IFN_COND_OP we might hit the reduction definition operand
- twice (once as definition, once as else). */
+ /* Skip reduction operands, and for an IFN_COND_OP we might hit the
+ reduction operand twice (once as definition, once as else). */
if (op.ops[i] == op.ops[STMT_VINFO_REDUC_IDX (stmt_info)])
continue;
--
2.17.1