[LLVMbugs] [Bug 3550] New: problem with tail call to function that accesses alloca' d memory

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Feb 11 07:30:37 PST 2009


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

           Summary: problem with tail call to function that accesses
                    alloca'd memory
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Interprocedural Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=2528)
 --> (http://llvm.org/bugs/attachment.cgi?id=2528)
test case

As I understand it, if you have a tail call from function F to function G, G
isn't allowed to access any memory alloca'd in F.

With the attached example, if I do:

llvm-as -o - bug.ll | opt -inline -scalarrepl -tailcallelim | llvm-dis

and then search for "tail.*memcpy", I find a tail call to memcpy which is
definitely reading and writing memory alloca'd in the calling function:

    %vint1 = alloca %"struct.stlpmtx_std::vector<int,StackAllocator<int> >"
    %tmp13.i = getelementptr
%"struct.stlpmtx_std::vector<int,StackAllocator<int> >"* %vint1, i32 0, i32 0
    %tmp14.i = getelementptr
%"struct.stlp_priv::_Vector_base<int,StackAllocator<int> >"* %tmp13.i, i32 0,
i32 2
    %tmp1.i.i.i.i291 = getelementptr
%"struct.stlp_priv::_STLP_alloc_proxy<int*,int,StackAllocator<int> >"*
%tmp14.i, i32 0, i32 0
    %tmp1.i.i.i.i.i.i = getelementptr %"struct.StackAllocator<int>"*
%tmp1.i.i.i.i291, i32 0, i32 0
    %tmp3.i.i.i.i.i.i.i = bitcast %struct.State* %tmp1.i.i.i.i.i.i to i8*
    tail call void @llvm.memcpy.i32(i8* %tmp3.i.i.i.i.i.i.i, i8*
%tmp4.i.i.i.i.i.i.i, i32 32, i32 4) nounwind

(I've only shown the instructions relevant to the memory that's being *written*
by the memcpy, but the memory being *read* also comes from a similar alloca.)

I'm using a recent build of LLVM on Linux/x86, from rev 64210 of head of svn.


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