1 ; RUN: opt -passes=globalopt %s -S -o - | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 %struct.A = type { %class.Wrapper }
6 %class.Wrapper = type { i32 }
10 @kA = internal global %struct.A zeroinitializer, align 4
11 ; CHECK: @kA = internal unnamed_addr constant %struct.A { %class.Wrapper { i32 1036831949 } }, align 4
13 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } {
14 i32 65535, ptr @_GLOBAL__sub_I_const_static.cc, ptr null }]
16 define dso_local i32 @AsBits(ptr %x) #0 {
18 %0 = load i32, ptr %x, align 4
22 define internal void @__cxx_global_var_init() #1 section ".text.startup" {
24 call void @Wrapper(ptr @kA, float 0x3FB99999A0000000)
25 %0 = call ptr @llvm.invariant.start.p0(i64 4, ptr @kA)
29 define linkonce_odr dso_local void @Wrapper(ptr %this, float %x) unnamed_addr #0 comdat align 2 {
31 %x.addr = alloca float, align 4
32 store float %x, ptr %x.addr, align 4
33 %call = call i32 @AsBits(ptr %x.addr)
34 store i32 %call, ptr %this, align 4
38 declare ptr @llvm.invariant.start.p0(i64, ptr nocapture) #2
40 ; Function Attrs: nounwind uwtable
41 define dso_local void @LoadIt(ptr %c) #0 {
43 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %c, ptr align 4 @kA, i64 4, i1 false)
47 ; Function Attrs: argmemonly nounwind
48 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #2
50 ; Function Attrs: uwtable
51 define internal void @_GLOBAL__sub_I_const_static.cc() #1 section ".text.startup" {
53 call void @__cxx_global_var_init()
57 attributes #0 = { nounwind uwtable "target-cpu"="x86-64" }
58 attributes #1 = { uwtable "target-cpu"="x86-64" }
59 attributes #2 = { argmemonly nounwind }