[LLVMbugs] [Bug 2488] New: instcombine removes stackrestore after alloca

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jun 24 06:38:39 PDT 2008


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

           Summary: instcombine removes stackrestore after alloca
           Product: libraries
           Version: 2.3
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu


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

The attached test case is based on gcc.c-torture/execute/20040811-1.c in the
GCC 4.2.1 testsuite (I just compiled it with -O1). It has a loop containing a
variable-sized alloca, with a call to llvm.stacksave before the alloca and
llvm.stackrestore after it.

If I run it through "opt -f -o post.o pre.o -instcombine" I get this:

bb44:           ; preds = %bb44, %entry
        %indvar = phi i32 [ 0, %entry ], [ %tmp3857, %bb44 ]            ; <i32>
[#uses=1]
        %tmp3857 = add i32 %indvar, 1           ; <i32> [#uses=3]
        %tmp2 = call i8* @llvm.stacksave( )             ; <i8*> [#uses=0]
        %tmp4 = srem i32 %tmp3857, 1000         ; <i32> [#uses=2]
        %tmp5 = add i32 %tmp4, 1                ; <i32> [#uses=1]
        %tmp27 = alloca i32, i32 %tmp5          ; <i32*> [#uses=3]
        %tmpcast = bitcast i32* %tmp27 to i8*           ; <i8*> [#uses=1]
        store i32 1, i32* %tmp27, align 4
        %tmp34 = getelementptr i32* %tmp27, i32 %tmp4           ; <i32*>
[#uses=1]
        store i32 2, i32* %tmp34, align 4
        volatile store i8* %tmpcast, i8** @p, align 4
        %exitcond = icmp eq i32 %tmp3857, 999999                ; <i1>
[#uses=1]
        br i1 %exitcond, label %bb, label %bb44

It has completely removed the call to llvm.stackrestore!

(See also bug 1851, where instcombine used to remove both the stacksave and the
stackrestore from this test case.)


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