[LLVMbugs] [Bug 2655] memcpyopt doesn't zap an alloca + memmove

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed May 6 09:21:09 PDT 2009


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


Chris Lattner <clattner at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




--- Comment #9 from Chris Lattner <clattner at apple.com>  2009-05-06 11:21:06 ---
The memcpy isn't present, but the memmove is.  Taking the code from the
description, adding nocapture to the stret result and using:
$ llvm-as < t.ll  | opt -memcpyopt | llvm-dis

gives:
define void @foo(%struct.out* nocapture sret %agg.result) {
entry:
        %out = alloca %struct.out, align 4              ; <%struct.out*>
[#uses=3]
        %tmp = getelementptr %struct.out* %out, i32 0, i32 0            ;
<i32*> [#uses=1]
        %call = call i32 @bar()         ; <i32> [#uses=1]
        store i32 %call, i32* %tmp
        %tmp1 = getelementptr %struct.out* %out, i32 0, i32 1           ;
<i32*> [#uses=1]
        %call2 = call i32 @bar()                ; <i32> [#uses=1]
        store i32 %call2, i32* %tmp1
        %tmp3 = bitcast %struct.out* %agg.result to i8*         ; <i8*>
[#uses=1]
        %tmp4 = bitcast %struct.out* %out to i8*                ; <i8*>
[#uses=1]
        call void @llvm.memmove.i32(i8* %tmp3, i8* %tmp4, i32 8, i32 4)
        ret void
}


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