[LLVMbugs] [Bug 4178] New: missed optimization: global variable not inlined

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 7 12:08:43 PDT 2009


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

           Summary: missed optimization: global variable not inlined
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Global Analyses
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: micah.villmow at amd.com
                CC: llvmbugs at cs.uiuc.edu


In this example, the global variable can be inlined and thus removing a load
operation.

; ModuleID = 'test-opt.bc'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16:16-i32:32:32:32-i64:64:64:64-f32:32:32:32-f64:64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-pc-win32"
@y = global i32 3, align 4              ; <i32*> [#uses=1]

define void @test_and(i32 %x, i32 addrspace(1)* %res) {
entry:
        %tmp = load i32* @y             ; <i32> [#uses=2]
        %tmp1 = add i32 %tmp, %tmp      ; <i32> [#uses=1]
        %arrayidx = getelementptr i32 addrspace(1)* %res, i32 %tmp1            
; <i32 addrspace(1)*> [#uses=1]
        %arrayidx6 = getelementptr i32 addrspace(1)* %res, i32 %x              
; <i32 addrspace(1)*> [#uses=1]
        %tmp7 = load i32 addrspace(1)* %arrayidx6               ; <i32>
[#uses=1]
        store i32 %tmp7, i32 addrspace(1)* %arrayidx
        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