aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorRoger Sayle <sayle@gcc.gnu.org>2005-02-28 17:21:20 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2005-02-28 17:21:20 +0000
commit4f380bf8157fbdbd61f8c385920b2f9ee43bdd60 (patch)
tree5bd6914eeae41f162eb223a6dcffc4ac7a49e58d /gcc/tree-ssa.c
parentdd1f53fbd778afa7c02785302ec62ec30dd2b687 (diff)
downloadgcc-4f380bf8157fbdbd61f8c385920b2f9ee43bdd60.zip
gcc-4f380bf8157fbdbd61f8c385920b2f9ee43bdd60.tar.gz
gcc-4f380bf8157fbdbd61f8c385920b2f9ee43bdd60.tar.bz2
re PR middle-end/19874 (ICE in emit_move_insn with __attribute__((mode (QI))) enum)
PR middle-end/19874 * tree-ssa.c (tree_ssa_useless_type_conversion_1): A conversion between different machine modes is never a "useless" conversion. * gcc.c-torture/execute/20050119-2.c: New test case. From-SVN: r95688
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index b39c260..9346d6c 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -778,11 +778,17 @@ delete_tree_ssa (void)
bool
tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
{
+ if (inner_type == outer_type)
+ return true;
+
+ /* Changes in machine mode are never useless conversions. */
+ if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type))
+ return false;
+
/* If the inner and outer types are effectively the same, then
strip the type conversion and enter the equivalence into
the table. */
- if (inner_type == outer_type
- || (lang_hooks.types_compatible_p (inner_type, outer_type)))
+ if (lang_hooks.types_compatible_p (inner_type, outer_type))
return true;
/* If both types are pointers and the outer type is a (void *), then
@@ -793,7 +799,6 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
implement the ABI. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
- && TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
&& TYPE_REF_CAN_ALIAS_ALL (inner_type)
== TYPE_REF_CAN_ALIAS_ALL (outer_type)
&& TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
@@ -803,7 +808,6 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
so strip conversions that just switch between them. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
- && TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
&& TYPE_REF_CAN_ALIAS_ALL (inner_type)
== TYPE_REF_CAN_ALIAS_ALL (outer_type)
&& lang_hooks.types_compatible_p (TREE_TYPE (inner_type),
@@ -819,7 +823,6 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
mean that testing of precision is necessary. */
else if (INTEGRAL_TYPE_P (inner_type)
&& INTEGRAL_TYPE_P (outer_type)
- && TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
&& TYPE_UNSIGNED (inner_type) == TYPE_UNSIGNED (outer_type)
&& TYPE_PRECISION (inner_type) == TYPE_PRECISION (outer_type))
{