1 ; RUN: opt -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, void ()*, i8* }] [{ i32, void ()*, i8* } {
14 i32 65535, void ()* @_GLOBAL__sub_I_const_static.cc, i8* null }]
16 define dso_local i32 @AsBits(float* %x) #0 {
18 %0 = bitcast float* %x to i32*
19 %1 = load i32, i32* %0, align 4
23 define internal void @__cxx_global_var_init() #1 section ".text.startup" {
25 call void @Wrapper(%class.Wrapper* getelementptr inbounds (%struct.A, %struct.A* @kA, i32 0, i32 0), float 0x3FB99999A0000000)
26 %0 = call {}* @llvm.invariant.start.p0i8(i64 4, i8* bitcast (%struct.A* @kA to i8*))
30 define linkonce_odr dso_local void @Wrapper(%class.Wrapper* %this, float %x) unnamed_addr #0 comdat align 2 {
32 %x.addr = alloca float, align 4
33 store float %x, float* %x.addr, align 4
34 %store_ = getelementptr inbounds %class.Wrapper, %class.Wrapper* %this, i32 0, i32 0
35 %call = call i32 @AsBits(float* %x.addr)
36 store i32 %call, i32* %store_, align 4
40 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) #2
42 ; Function Attrs: nounwind uwtable
43 define dso_local void @LoadIt(%struct.A* %c) #0 {
45 %0 = bitcast %struct.A* %c to i8*
46 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast (%struct.A* @kA to i8*), i64 4, i1 false)
50 ; Function Attrs: argmemonly nounwind
51 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #2
53 ; Function Attrs: uwtable
54 define internal void @_GLOBAL__sub_I_const_static.cc() #1 section ".text.startup" {
56 call void @__cxx_global_var_init()
60 attributes #0 = { nounwind uwtable "target-cpu"="x86-64" }
61 attributes #1 = { uwtable "target-cpu"="x86-64" }
62 attributes #2 = { argmemonly nounwind }