]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/109848 - fix TARGET_MEM_REF store from CTOR simplification
authorRichard Biener <rguenther@suse.de>
Mon, 15 May 2023 07:10:08 +0000 (09:10 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 15 May 2023 08:40:54 +0000 (10:40 +0200)
I've put the preparation stmt in the wrong place.

PR tree-optimization/109848
* tree-ssa-forwprop.cc (pass_forwprop::execute): Put the
TARGET_MEM_REF address preparation before the store, not
before the CTOR.

gcc/tree-ssa-forwprop.cc

index e63d2ab82c93d59bf894567008a23367f5d28652..06f19868ade7ec51658afe58f326148c6e3216b0 100644 (file)
@@ -3841,7 +3841,10 @@ pass_forwprop::execute (function *fun)
                  if (auto_var_p (use_lhs))
                    DECL_NOT_GIMPLE_REG_P (use_lhs) = 1;
                  else if (TREE_CODE (use_lhs) == TARGET_MEM_REF)
-                   use_lhs = prepare_target_mem_ref_lvalue (use_lhs, &gsi);
+                   {
+                     gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
+                     use_lhs = prepare_target_mem_ref_lvalue (use_lhs, &gsi2);
+                   }
                  for (unsigned HOST_WIDE_INT bi = 0; bi < n; bi += elt_w)
                    {
                      unsigned HOST_WIDE_INT ci = bi / elt_w;