http://llvm.org/bugs/show_bug.cgi?id=3845

           Summary: Stale MachineInstruction pointer reference in
                    replaceFrameIndices can cause certain frameindices to
                    not be replaced
           Product: libraries
           Version: 2.5
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


During traversal of the instruction iterator in order to locate and replace
CallFramePseudo Instructions and instructions bearing FrameIndices, the
replaceFrameIndices function stores a pointer to the current MachineInstr.
(line 516 in
http://llvm.org/viewvc/llvm-project/llvm/tags/RELEASE_25/lib/CodeGen/PrologEpilogInserter.cpp?annotate=65926)

It then possibly performs the CallFramePseudoInstr elimination, possibly
removing the instruction pointed to from the basic block. (Lines 524 to 542).

It then loops over all operands of the MachineInstr pointed to by the stored
pointer, in order to find and replace frame indices. (lines 546 to 569). This
is a stale pointer. This stored pointer is no longer valid. A new pointer
should be retrieved from the current iterator location.

When the stale pointer is used, a sequence in which a frameindex appears in the
instruction immediately following a CallFramePseudoInstr can result in the
frameindex not being replaced, causing it to continue to exist all the way
through to the AsmPrinter pass.

To fix this issue, simply mov the assignment at line 516 to line 546.

(Note also that the Register Scavenger is updated using this stale pointer as
well - line 576).


-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to