[Bug tree-optimization/14627] [4.0/4.1 regression] extra assignment inserted on the tree level

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Mar 20 00:58:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list