[LLVMbugs] [Bug 1735] New: deadargelim changes result of function call

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Oct 17 07:45:00 PDT 2007


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

           Summary: deadargelim changes result of function call
           Product: libraries
           Version: 2.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          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=1165)
 --> (http://llvm.org/bugs/attachment.cgi?id=1165)
bitcode for test case

In the attached bitcode file, main() calls f() and checks the result:

        %tmp38 = call i32 ([...])* @f( [...] )            ; <i32> [#uses=1]
        %tmp39 = icmp eq i32 %tmp38, 4660               ; <i1> [#uses=1]

If I run it through "opt -f -o post.o pre.o -deadargelim", this has changed to:

        %tmp38 = call i32 @f( [...] )          ; <i32> [#uses=0]
        %tmp39 = icmp eq i32 0, 4660            ; <i1> [#uses=1]

The use of %tmp38 has been replaced with 0. But f() doesn't return 0, it
returns 4660:

        store i32 4660, i32* %pb_addr
        %retval20 = bitcast i32* %retval to {  }*               ; <{  }*>
[#uses=0]
        %tmp22 = load i32* %pb_addr             ; <i32> [#uses=2]
        store i32 %tmp22, i32* %retval
        ret i32 %tmp22

So why has the result of the call been replaced with 0?

This code is taken from gcc.c-torture/execute/20030914-2.c in the gcc
testsuite.


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