public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/109848 - fix TARGET_MEM_REF store from CTOR simplification
@ 2023-05-15  8:40 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-05-15  8:40 UTC (permalink / raw)
  To: gcc-patches

I've put the preparation stmt in the wrong place.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index e63d2ab82c9..06f19868ade 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -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;
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-15  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15  8:40 [PATCH] tree-optimization/109848 - fix TARGET_MEM_REF store from CTOR simplification Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).