[LLVMbugs] [Bug 2343] New: llvm-gcc bootstrap is broken

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon May 19 10:03:20 PDT 2008


           Summary: llvm-gcc bootstrap is broken
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: asl at math.spbu.ru
                CC: evan.cheng at apple.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com

Created an attachment (id=1655)
 --> (http://llvm.org/bugs/attachment.cgi?id=1655)
Function is question

It seems, that recent taildup changes revealed some subtle bugs not known
before. Consider attached .bc file. The C snippet in question is:

        tree cases = get_cases_for_edge (e, stmt);

        /* If we have a list of cases associated with E, then use it
           as it's a lot faster than walking the entire case vector.  */
        if (cases)
            edge e2 = find_edge (e->src, dest);
            tree last, first;

            first = cases;
            while (cases)
                last = cases;
                CASE_LABEL (cases) = label;
                cases = TREE_CHAIN (cases);

            /* If there was already an edge in the CFG, then we need
               to move all the cases associated with E to E2.  */
             if (e2)
                tree cases2 = get_cases_for_edge (e2, stmt);

                TREE_CHAIN (last) = TREE_CHAIN (cases2);
                TREE_CHAIN (cases2) = first;

>From this we can see, that last is the 'if (e2)' is always non-NULL. The LLVM
IR is also fine (only part showed):

bb392:          ; preds = %bb379, %bb319
        %last.0 = phi %struct.tree_node* [ undef, %bb319 ], [ %cases.0, %bb379
]                ; <%struct.tree_node*> [#use$
        %cases.0 = phi %struct.tree_node* [ %tmp314, %bb319 ], [ %tmp391,
%bb379 ]              ; <%struct.tree_node*> [#use$
        %tmp394 = icmp eq %struct.tree_node* %cases.0, null             ; <i1>
        br i1 %tmp394, label %bb397, label %bb326

This is header of the loop and jump from %bb319 is possible iff %tmp314 is
non-null, thus loop executes at least one time and %last.0 is properly
initialized (thus - non null).

Let's look into generated assembler:
        movl    %ecx, %ebx
        testl   %ebx, %ebx
        jne     .LBB1_47        # bb326
.LBB1_52:       # bb397
        testl   %eax, %eax
        je      .LBB1_80        # bb695
.LBB1_53:       # bb402
        movl    %esi, 4(%esp)
        movl    %eax, (%esp)
        call    get_cases_for_edge
        movl    (%eax), %esi
        movl    %esi, (%ebx)

here %last.0 is %ebx and we saw that after call %ebx is always zero! I suppose,
that codedegen 'merged' %last.0 and %cases.0 somehow (or some codegen passes)

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list