This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/14627] [4.0/4.1 regression] extra assignment inserted on the tree level
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Mar 2005 00:58:13 -0000
- Subject: [Bug tree-optimization/14627] [4.0/4.1 regression] extra assignment inserted on the tree level
- References: <20040318034843.14627.dann@godzilla.ics.uci.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From steven at gcc dot gnu dot org 2005-03-20 00:58 -------
int b;
void foo (int a) {
if (a)
a = 3;
b = a;
}
GCC 3.3.5 (hammer-branch) on AMD64 -O2:
foo:
.LFB3:
testl %edi, %edi
movl $3, %eax
cmovne %eax, %edi
movl %edi, b(%rip)
ret
.LFE3:
GCC 4.1.0 20050317 -O2:
foo:
.LFB2:
cmpl $1, %edi
sbbl %eax, %eax
notl %eax
andl $3, %eax
movl %eax, b(%rip)
ret
.LFE2:
GCC 4.1.0 20050317 -O2 -fno-tree-dominator-opts:
foo:
.LFB2:
testl %edi, %edi
movl $3, %eax
cmovne %eax, %edi
movl %edi, b(%rip)
ret
.LFE2:
This really is DOM's doing, as already mentioned in comment #1. It pushes
the constants into the PHI nodes as PHI arguments.
Why do we allow constants as PHI arguments? I do not see any easy way to
avoid inserting an assignment that was not there in the original code. And
as my example above showed, we never again get rid of the assignment either.
Technically this is even a regression from GCC 3.3 and GCC 3.4.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[tree-ssa] extra assignment |[4.0/4.1 regression] extra
|inserted on the tree level |assignment inserted on the
| |tree level
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14627