- Add add-checks-to-avoid-spoiling-if-conversion.patch - Add add-option-fallow-store-data-races.patch - Add complete-struct-reorg.patch - Add cse-in-vectorization.patch - Add enable-simd-math.patch - Add fix-ICE-avoid-issueing-loads-in-SM-when-possible.patch - Add fix-ICE-in-compute_live_loop_exits.patch - Add fix-ICE-in-copy_reference_ops_from_ref.patch - Add fix-ICE-in-declare-return-variable.patch - Add fix-ICE-in-exact_div.patch - Add fix-ICE-in-gimple_op.patch - Add fix-ICE-in-model_update_limit_points_in_group.patch - Add fix-ICE-in-reload.patch - Add fix-ICE-in-store_constructor.patch - Add fix-ICE-in-vec.patch - Add fix-ICE-in-vect_create_epilog_for_reduction.patch - Add fix-ICE-in-vect_create_epilog_for_reduction_2.patch - Add fix-ICE-in-vect_create_epilog_for_reduction_3.patch - Add fix-ICE-in-vect_get_vec_def_for_stmt_copy.patch - Add fix-ICE-in-vect_slp_analyze_node_operations.patch - Add fix-ICE-in-vect_stmt_to_vectorize.patch - Add fix-ICE-in-vect_transform_stmt.patch - Add fix-ICE-in-vectorizable_condition.patch - Add fix-ICE-in-verify_ssa.patch - Add fix-ICE-statement-uses-released-SSA-name.patch - Add fix-ICE-when-vectorizing-nested-cycles.patch - Add fix-SSA-update-for-vectorizer-epilogue.patch - Add fix-do-not-build-op.patch - Add fix-load-eliding-in-SM.patch - Add fix-wrong-vectorizer-code.patch - Add generate-csel-for-arrayref.patch - Add ipa-const-prop-self-recursion-bugfix.patch - Add ipa-const-prop.patch - Add ipa-struct-reorg-bugfix.patch - Add ipa-struct-reorg.patch - Add medium-code-mode.patch - Add reduction-chain-slp-option.patch - Add reductions-slp-enhancement.patch - Add simplify-removing-subregs.patch - Add tighten-range-for-generating-csel.patch - Add vectorization-enhancement.patch - Add add-checks-to-avoid-spoiling-if-conversion.patch - Add add-option-fallow-store-data-races.patch - Add complete-struct-reorg.patch - Add cse-in-vectorization.patch - Add enable-simd-math.patch - Add fix-ICE-avoid-issueing-loads-in-SM-when-possible.patch - Add fix-ICE-in-compute_live_loop_exits.patch - Add fix-ICE-in-copy_reference_ops_from_ref.patch - Add fix-ICE-in-declare-return-variable.patch - Add fix-ICE-in-exact_div.patch - Add fix-ICE-in-gimple_op.patch - Add fix-ICE-in-model_update_limit_points_in_group.patch - Add fix-ICE-in-reload.patch - Add fix-ICE-in-store_constructor.patch - Add fix-ICE-in-vec.patch - Add fix-ICE-in-vect_create_epilog_for_reduction.patch - Add fix-ICE-in-vect_create_epilog_for_reduction_2.patch - Add fix-ICE-in-vect_create_epilog_for_reduction_3.patch - Add fix-ICE-in-vect_get_vec_def_for_stmt_copy.patch - Add fix-ICE-in-vect_slp_analyze_node_operations.patch - Add fix-ICE-in-vect_stmt_to_vectorize.patch - Add fix-ICE-in-vect_transform_stmt.patch - Add fix-ICE-in-vectorizable_condition.patch - Add fix-ICE-in-verify_ssa.patch - Add fix-ICE-statement-uses-released-SSA-name.patch - Add fix-ICE-when-vectorizing-nested-cycles.patch - Add fix-SSA-update-for-vectorizer-epilogue.patch - Add fix-do-not-build-op.patch - Add fix-load-eliding-in-SM.patch - Add fix-wrong-vectorizer-code.patch - Add generate-csel-for-arrayref.patch - Add ipa-const-prop-self-recursion-bugfix.patch - Add ipa-const-prop.patch - Add ipa-struct-reorg-bugfix.patch - Add ipa-struct-reorg.patch - Add medium-code-mode.patch - Add reduction-chain-slp-option.patch - Add reductions-slp-enhancement.patch - Add simplify-removing-subregs.patch - Add tighten-range-for-generating-csel.patch - Add vectorization-enhancement.patch
87 lines
3.1 KiB
Diff
87 lines
3.1 KiB
Diff
This backport contains 1 patch from gcc main stream tree.
|
|
The commit id of these patchs list as following in the order of time.
|
|
|
|
0001-tree-optimization-95855-Add-checks-to-avoid-spoiling.patch
|
|
33d114f570b4a3583421c700396fd5945acebc28
|
|
|
|
diff -uprN a/gcc/gimple-ssa-split-paths.c b/gcc/gimple-ssa-split-paths.c
|
|
--- a/gcc/gimple-ssa-split-paths.c
|
|
+++ b/gcc/gimple-ssa-split-paths.c
|
|
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
|
|
#include "gimple-ssa.h"
|
|
#include "tree-phinodes.h"
|
|
#include "ssa-iterators.h"
|
|
+#include "fold-const.h"
|
|
|
|
/* Given LATCH, the latch block in a loop, see if the shape of the
|
|
path reaching LATCH is suitable for being split by duplication.
|
|
@@ -254,6 +255,44 @@ is_feasible_trace (basic_block bb)
|
|
}
|
|
}
|
|
|
|
+ /* Canonicalize the form. */
|
|
+ if (single_pred_p (pred1) && single_pred (pred1) == pred2
|
|
+ && num_stmts_in_pred1 == 0)
|
|
+ std::swap (pred1, pred2);
|
|
+
|
|
+ /* This is meant to catch another kind of cases that are likely opportunities
|
|
+ for if-conversion. After canonicalizing, PRED2 must be an empty block and
|
|
+ PRED1 must be the only predecessor of PRED2. Moreover, PRED1 is supposed
|
|
+ to end with a cond_stmt which has the same args with the PHI in BB. */
|
|
+ if (single_pred_p (pred2) && single_pred (pred2) == pred1
|
|
+ && num_stmts_in_pred2 == 0)
|
|
+ {
|
|
+ gimple *cond_stmt = last_stmt (pred1);
|
|
+ if (cond_stmt && gimple_code (cond_stmt) == GIMPLE_COND)
|
|
+ {
|
|
+ tree lhs = gimple_cond_lhs (cond_stmt);
|
|
+ tree rhs = gimple_cond_rhs (cond_stmt);
|
|
+
|
|
+ gimple_stmt_iterator gsi;
|
|
+ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
|
|
+ {
|
|
+ gimple *phi = gsi_stmt (gsi);
|
|
+ if ((operand_equal_p (gimple_phi_arg_def (phi, 0), lhs)
|
|
+ && operand_equal_p (gimple_phi_arg_def (phi, 1), rhs))
|
|
+ || (operand_equal_p (gimple_phi_arg_def (phi, 0), rhs)
|
|
+ && (operand_equal_p (gimple_phi_arg_def (phi, 1), lhs))))
|
|
+ {
|
|
+ if (dump_file && (dump_flags & TDF_DETAILS))
|
|
+ fprintf (dump_file,
|
|
+ "Block %d appears to be optimized to a join "
|
|
+ "point for if-convertable half-diamond.\n",
|
|
+ bb->index);
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
/* If the joiner has no PHIs with useful uses there is zero chance
|
|
of CSE/DCE/jump-threading possibilities exposed by duplicating it. */
|
|
bool found_useful_phi = false;
|
|
diff -uprN a/gcc/testsuite/gcc.dg/tree-ssa/split-path-12.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-12.c
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-12.c
|
|
@@ -0,0 +1,19 @@
|
|
+/* { dg-do compile } */
|
|
+/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details " } */
|
|
+
|
|
+double
|
|
+foo(double *d1, double *d2, double *d3, int num, double *ip)
|
|
+{
|
|
+ double dmax[3];
|
|
+
|
|
+ for (int i = 0; i < num; i++) {
|
|
+ dmax[0] = d1[i] < dmax[0] ? dmax[0] : d1[i];
|
|
+ dmax[1] = d2[i] < dmax[1] ? dmax[1] : d2[i];
|
|
+ dmax[2] = d3[i] < dmax[2] ? dmax[2] : d3[i];
|
|
+ ip[i] = dmax[2];
|
|
+ }
|
|
+
|
|
+ return dmax[0] + dmax[1] + dmax[2];
|
|
+}
|
|
+
|
|
+/* { dg-final { scan-tree-dump "appears to be optimized to a join point for if-convertable half-diamond" "split-paths" } } */
|