summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-21 11:45:27 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-21 11:45:27 +0000
commitb858a81abac92c4d3d7f6c1c5c233da22a0f59d7 (patch)
treea555e3dcdaf2bc02ef5701b559e9a66712504d98 /gcc
parent11bbec1341e4d8a1ddfc7e5f81e1ef251dd3cff4 (diff)
downloadgcc-b858a81abac92c4d3d7f6c1c5c233da22a0f59d7.tar.gz
2010-07-21 Richard Guenther <rguenther@suse.de>
PR middle-end/45013 * tree-ssa.c (useless_type_conversion_p): Dispatch to gimple_types_compatible_p only when in lto. * gimple.c (gimple_types_compatible_p): Use canonical types to speed up comparison. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple.c6
-rw-r--r--gcc/tree-ssa.c3
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 313baf6c36d..12aa9e3ad01 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2010-07-21 Richard Guenther <rguenther@suse.de>
+ PR middle-end/45013
+ * tree-ssa.c (useless_type_conversion_p): Dispatch to
+ gimple_types_compatible_p only when in lto.
+ * gimple.c (gimple_types_compatible_p): Use canonical types
+ to speed up comparison.
+
+2010-07-21 Richard Guenther <rguenther@suse.de>
+
* tree-flow.h (referenced_var): Move define ...
* tree-flow-inline.h (referenced_var): ... here as an inline
function. Assert here ...
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a3b1bba97c5..5ad79aaa071 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3360,6 +3360,12 @@ gimple_types_compatible_p (tree t1, tree t2, bool for_merging_p)
if (t1 == NULL_TREE || t2 == NULL_TREE)
return 0;
+ /* If the types have been previously registered and found equal
+ they still are. */
+ if (TYPE_CANONICAL (t1)
+ && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2))
+ return 1;
+
/* Can't be the same type if the types don't have the same code. */
if (TREE_CODE (t1) != TREE_CODE (t2))
return 0;
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 0be459118e5..ba28c64fc83 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1426,7 +1426,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
compared types. */
else if (AGGREGATE_TYPE_P (inner_type)
&& TREE_CODE (inner_type) == TREE_CODE (outer_type))
- return gimple_types_compatible_p (outer_type, inner_type, false);
+ return (in_lto_p
+ && gimple_types_compatible_p (outer_type, inner_type, false));
return false;
}