gcc/fix-load-eliding-in-SM.patch
jdkboy db8a90ff34 Add several enhancement patches
- 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
2020-08-29 15:26:30 +08:00

56 lines
2.0 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-94949-fix-load-eliding-in-SM.patch
0424a5ece5307cc22bbc0fe97edf4707d7a798ed
diff -Nurp a/gcc/testsuite/gcc.dg/torture/pr94949.c b/gcc/testsuite/gcc.dg/torture/pr94949.c
--- a/gcc/testsuite/gcc.dg/torture/pr94949.c 1970-01-01 08:00:00.000000000 +0800
+++ b/gcc/testsuite/gcc.dg/torture/pr94949.c 2020-08-24 21:40:32.208000000 +0800
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+static int x = 1;
+static volatile int y = -1;
+int
+main()
+{
+ for (int i = 0; i < 128; ++i)
+ {
+ if (i == y)
+ x = i;
+ }
+ if (x != 1)
+ __builtin_abort ();
+ return 0;
+}
diff -Nurp a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
--- a/gcc/tree-ssa-loop-im.c 2020-08-24 21:40:14.164000000 +0800
+++ b/gcc/tree-ssa-loop-im.c 2020-08-24 21:40:32.208000000 +0800
@@ -2115,9 +2115,9 @@ execute_sm (struct loop *loop, vec<edge>
fmt_data.orig_loop = loop;
for_each_index (&ref->mem.ref, force_move_till, &fmt_data);
+ bool always_stored = ref_always_accessed_p (loop, ref, true);
if (bb_in_transaction (loop_preheader_edge (loop)->src)
- || (! flag_store_data_races
- && ! ref_always_accessed_p (loop, ref, true)))
+ || (! flag_store_data_races && ! always_stored))
multi_threaded_model_p = true;
if (multi_threaded_model_p)
@@ -2132,8 +2132,10 @@ execute_sm (struct loop *loop, vec<edge>
/* Avoid doing a load if there was no load of the ref in the loop.
Esp. when the ref is not always stored we cannot optimize it
- away later. */
- if (ref->loaded && bitmap_bit_p (ref->loaded, loop->num))
+ away later. But when it is not always stored we must use a conditional
+ store then. */
+ if ((!always_stored && !multi_threaded_model_p)
+ || (ref->loaded && bitmap_bit_p (ref->loaded, loop->num)))
{
load = gimple_build_assign (tmp_var, unshare_expr (ref->mem.ref));
lim_data = init_lim_data (load);