This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/47258] Extra instruction generated in 4.5.2
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Jan 2011 16:34:51 +0000
- Subject: [Bug rtl-optimization/47258] Extra instruction generated in 4.5.2
- Auto-submitted: auto-generated
- References: <bug-47258-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47258
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-11 16:34:40 UTC ---
(In reply to comment #2)
> After tried patches one-by-one, I believe the misoptimization is down to the
> following patch.
Which is a correctness patch. You can try dumbing it down somewhat with
if (TYPE_MAIN_VARIANT (TREE_TYPE (root1)) != TYPE_MAIN_VARIANT (TREE_TYPE
(root2))
|| !types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
and see if that helps.
> Index: tree-ssa-copyrename.c
> ===================================================================
> RCS file: /cvs/dev/tools/src/fp_gcc/gcc/tree-ssa-copyrename.c,v
> retrieving revision 1.1.2.5.2.1
> retrieving revision 1.1.2.5.2.2
> diff -u -r1.1.2.5.2.1 -r1.1.2.5.2.2
> --- tree-ssa-copyrename.c 12 Apr 2010 13:15:43 -0000 1.1.2.5.2.1
> +++ tree-ssa-copyrename.c 13 Dec 2010 05:51:45 -0000 1.1.2.5.2.2
> @@ -225,11 +225,11 @@
> ign2 = false;
> }
>
> - /* Don't coalesce if the two variables aren't type compatible. */
> - if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
> + /* Don't coalesce if the two variables are not of the same type. */
> + if (TREE_TYPE (root1) != TREE_TYPE (root2))
> {
> if (debug)
> - fprintf (debug, " : Incompatible types. No coalesce.\n");
> + fprintf (debug, " : Different types. No coalesce.\n");
> return false;
> }