[LLVMbugs] [Bug 4973] New: missed load through bitcasted global

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Sep 13 22:04:16 PDT 2009


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

           Summary: missed load through bitcasted global
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


This load should get eliminated:
--
ddunbar at giles:tmp$ cat t.ll
; ModuleID = 't.cpp'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"

%0 = type { i8, [3 x i8] }
%struct.s0 = type <{ i8, [3 x i8] }>

@g0 = private constant %0 { i8 13, [3 x i8] zeroinitializer }, align 4

define i8 @f0() nounwind {
  %t0 = load i8* getelementptr (%struct.s0* bitcast (%0* @g0 to %struct.s0*),
i64 0, i32 0), align 4
  ret i8 %t0
}
ddunbar at giles:tmp$ opt < t.ll -S -O3
; ModuleID = '<stdin>'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"

%0 = type { i8, [3 x i8] }
%struct.s0 = type <{ i8, [3 x i8] }>

@g0 = private constant %0 { i8 13, [3 x i8] zeroinitializer }, align 4 ; <%0*>
[#uses=1]

define i8 @f0() nounwind readnone {
  %t0 = load i8* getelementptr (%struct.s0* bitcast (%0* @g0 to %struct.s0*),
i64 0, i32 0), align 4 ; <i8> [#uses=1]
  ret i8 %t0
}
--


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