summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-24 07:26:52 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-24 07:26:52 +0000
commit31cbcee1c0bdfb2a1a4aa5b5312388b73847a27b (patch)
tree5835f9cdd7df1edbcc8445fba0d12041daf92a71
parentaf54c969b934918194baf95143a6d88814edd77f (diff)
downloadgcc-31cbcee1c0bdfb2a1a4aa5b5312388b73847a27b.tar.gz
PR middle-end/82569
* tree-outof-ssa.h (always_initialized_rtx_for_ssa_name_p): Delete. * expr.c (expand_expr_real_1) <expand_decl_rtl>: Revert latest change. * loop-iv.c (iv_get_reaching_def): Likewise. * cfgexpand.c (expand_one_ssa_partition): Initialize the RTX if the variable is promoted and the partition contains undefined values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254037 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cfgexpand.c10
-rw-r--r--gcc/expr.c33
-rw-r--r--gcc/loop-iv.c2
-rw-r--r--gcc/tree-outof-ssa.h12
5 files changed, 26 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63f84f52f71..f42428c57f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/82569
+ * tree-outof-ssa.h (always_initialized_rtx_for_ssa_name_p): Delete.
+ * expr.c (expand_expr_real_1) <expand_decl_rtl>: Revert latest change.
+ * loop-iv.c (iv_get_reaching_def): Likewise.
+ * cfgexpand.c (expand_one_ssa_partition): Initialize the RTX if the
+ variable is promoted and the partition contains undefined values.
+
2017-10-23 Sandra Loosemore <sandra@codesourcery.com>
* config/nios2/nios2.c (nios2_rtx_costs): Make costs better
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 00efe141213..ec8c8459d12 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1391,10 +1391,18 @@ expand_one_ssa_partition (tree var)
}
machine_mode reg_mode = promote_ssa_mode (var, NULL);
-
rtx x = gen_reg_rtx (reg_mode);
set_rtl (var, x);
+
+ /* For a promoted variable, X will not be used directly but wrapped in a
+ SUBREG with SUBREG_PROMOTED_VAR_P set, which means that the RTL land
+ will assume that its upper bits can be inferred from its lower bits.
+ Therefore, if X isn't initialized on every path from the entry, then
+ we must do it manually in order to fulfill the above assumption. */
+ if (reg_mode != TYPE_MODE (TREE_TYPE (var))
+ && bitmap_bit_p (SA.partitions_for_undefined_values, part))
+ emit_move_insn (x, CONST0_RTX (reg_mode));
}
/* Record the association between the RTL generated for partition PART
diff --git a/gcc/expr.c b/gcc/expr.c
index cdf7ca2cf5c..496d492c9fa 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9912,43 +9912,24 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
&& GET_MODE (decl_rtl) != dmode)
{
machine_mode pmode;
- bool always_initialized_rtx;
/* Get the signedness to be used for this variable. Ensure we get
the same mode we got when the variable was declared. */
if (code != SSA_NAME)
- {
- pmode = promote_decl_mode (exp, &unsignedp);
- always_initialized_rtx = true;
- }
+ pmode = promote_decl_mode (exp, &unsignedp);
else if ((g = SSA_NAME_DEF_STMT (ssa_name))
&& gimple_code (g) == GIMPLE_CALL
&& !gimple_call_internal_p (g))
- {
- pmode = promote_function_mode (type, mode, &unsignedp,
- gimple_call_fntype (g), 2);
- always_initialized_rtx
- = always_initialized_rtx_for_ssa_name_p (ssa_name);
- }
+ pmode = promote_function_mode (type, mode, &unsignedp,
+ gimple_call_fntype (g),
+ 2);
else
- {
- pmode = promote_ssa_mode (ssa_name, &unsignedp);
- always_initialized_rtx
- = always_initialized_rtx_for_ssa_name_p (ssa_name);
- }
-
+ pmode = promote_ssa_mode (ssa_name, &unsignedp);
gcc_assert (GET_MODE (decl_rtl) == pmode);
temp = gen_lowpart_SUBREG (mode, decl_rtl);
-
- /* We cannot assume anything about an existing extension if the
- register may contain uninitialized bits. */
- if (always_initialized_rtx)
- {
- SUBREG_PROMOTED_VAR_P (temp) = 1;
- SUBREG_PROMOTED_SET (temp, unsignedp);
- }
-
+ SUBREG_PROMOTED_VAR_P (temp) = 1;
+ SUBREG_PROMOTED_SET (temp, unsignedp);
return temp;
}
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 45e822980ff..1d0c66f2b2f 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -353,7 +353,7 @@ iv_get_reaching_def (rtx_insn *insn, rtx reg, df_ref *def)
adef = DF_REF_CHAIN (use)->ref;
/* We do not handle setting only part of the register. */
- if (DF_REF_FLAGS (adef) & (DF_REF_READ_WRITE | DF_REF_SUBREG))
+ if (DF_REF_FLAGS (adef) & DF_REF_READ_WRITE)
return GRD_INVALID;
def_insn = DF_REF_INSN (adef);
diff --git a/gcc/tree-outof-ssa.h b/gcc/tree-outof-ssa.h
index 1220b6256ca..ebbaea1a03e 100644
--- a/gcc/tree-outof-ssa.h
+++ b/gcc/tree-outof-ssa.h
@@ -74,18 +74,6 @@ get_gimple_for_ssa_name (tree exp)
return NULL;
}
-/* Return whether the RTX expression representing the storage of the outof-SSA
- partition that the SSA name EXP is a member of is always initialized. */
-static inline bool
-always_initialized_rtx_for_ssa_name_p (tree exp)
-{
- int p = partition_find (SA.map->var_partition, SSA_NAME_VERSION (exp));
- if (SA.map->partition_to_view)
- p = SA.map->partition_to_view[p];
- gcc_assert (p != NO_PARTITION);
- return !bitmap_bit_p (SA.partitions_for_undefined_values, p);
-}
-
extern bool ssa_is_replaceable_p (gimple *stmt);
extern void finish_out_of_ssa (struct ssaexpand *sa);
extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa);