aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-04-26 15:47:13 +0200
committerRichard Biener <rguenther@suse.de>2024-06-21 11:20:43 +0200
commita43c9bea7bd80af33ae116e7197f814ad911857e (patch)
treeeb1456a7a50da7e957d4b4e563b144d32e7c83ad
parentdae4d8ee395fbf0fabacc3dd6df7b1588312203f (diff)
downloadgcc-a43c9bea7bd80af33ae116e7197f814ad911857e.zip
gcc-a43c9bea7bd80af33ae116e7197f814ad911857e.tar.gz
gcc-a43c9bea7bd80af33ae116e7197f814ad911857e.tar.bz2
middle-end/114734 - wrong code with expand_call_mem_ref
When expand_call_mem_ref looks at the definition of the address argument to eventually expand a &TARGET_MEM_REF argument together with a masked load it fails to honor constraints imposed by SSA coalescing decisions. The following fixes this. PR middle-end/114734 * internal-fn.c (expand_call_mem_ref): Use get_gimple_for_ssa_name to get at the def stmt of the address argument to honor SSA coalescing constraints. (cherry picked from commit 20ebcaf826c91ddaf2aac35417ec1e5e6d31ad50)
-rw-r--r--gcc/internal-fn.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index dc4337c..ebd3da3 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -51,6 +51,11 @@ along with GCC; see the file COPYING3. If not see
#include "ssa-iterators.h"
#include "explow.h"
#include "rtl-iter.h"
+#include "tree-ssa-live.h"
+#include "tree-outof-ssa.h"
+
+/* For lang_hooks.types.type_for_mode. */
+#include "langhooks.h"
/* The names of each internal function, indexed by function number. */
const char *const internal_fn_name_array[] = {
@@ -2677,8 +2682,8 @@ expand_call_mem_ref (tree type, gcall *stmt, int index)
tree tmp = addr;
if (TREE_CODE (tmp) == SSA_NAME)
{
- gimple *def = SSA_NAME_DEF_STMT (tmp);
- if (gimple_assign_single_p (def))
+ gimple *def = get_gimple_for_ssa_name (tmp);
+ if (def && gimple_assign_single_p (def))
tmp = gimple_assign_rhs1 (def);
}