1 ; RUN: opt -globalopt -S -o - < %s | FileCheck %s
3 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-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 declare {}* @llvm.invariant.start.p0i8(i64 %size, i8* nocapture %ptr)
8 define void @test1(i8* %ptr) {
9 call {}* @llvm.invariant.start.p0i8(i64 4, i8* %ptr)
13 @object1 = global i32 0
14 ; CHECK: @object1 = constant i32 -1
15 define void @ctor1() {
16 store i32 -1, i32* @object1
17 %A = bitcast i32* @object1 to i8*
18 call void @test1(i8* %A)
23 @object2 = global i32 0
24 ; CHECK: @object2 = global i32 0
25 define void @ctor2() {
26 store i32 -1, i32* @object2
27 %A = bitcast i32* @object2 to i8*
28 %B = call {}* @llvm.invariant.start.p0i8(i64 4, i8* %A)
29 %C = bitcast {}* %B to i8*
34 @object3 = global i32 0
35 ; CHECK: @object3 = global i32 -1
36 define void @ctor3() {
37 store i32 -1, i32* @object3
38 %A = bitcast i32* @object3 to i8*
39 call {}* @llvm.invariant.start.p0i8(i64 3, i8* %A)
44 @object4 = global i32 0
45 ; CHECK: @object4 = global i32 -1
46 define void @ctor4() {
47 store i32 -1, i32* @object4
48 %A = bitcast i32* @object4 to i8*
49 call {}* @llvm.invariant.start.p0i8(i64 -1, i8* %A)
54 @llvm.global_ctors = appending constant
55 [4 x { i32, void ()*, i8* }]
56 [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor1, i8* null },
57 { i32, void ()*, i8* } { i32 65535, void ()* @ctor2, i8* null },
58 { i32, void ()*, i8* } { i32 65535, void ()* @ctor3, i8* null },
59 { i32, void ()*, i8* } { i32 65535, void ()* @ctor4, i8* null } ]