• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %s -globalopt -S | FileCheck %s
2
3@a = internal global i32 0, align 4
4@b = internal global i32 0, align 4
5@c = internal global i32 0, align 4
6@d = internal constant [4 x i8] c"foo\00", align 1
7
8; CHECK: @a = internal global i32 0, align 4
9; CHECK: @b = internal global i32 0, align 4
10; CHECK: @c = internal unnamed_addr global i32 0, align 4
11; CHECK: @d = internal unnamed_addr constant [4 x i8] c"foo\00", align 1
12
13define i1 @bah(i64 %i) nounwind readonly optsize ssp {
14entry:
15  %arrayidx4 = getelementptr inbounds [4 x i8]* @d, i64 0, i64 %i
16  %tmp5 = load i8* %arrayidx4, align 1
17  %cmp = icmp eq i8 %tmp5, 42
18  ret i1 %cmp
19}
20
21define void @baz(i32 %x) {
22entry:
23  store i32 %x, i32* @a, align 4
24  store i32 %x, i32* @b, align 4
25  store i32 %x, i32* @c, align 4
26  ret void
27}
28
29define i32 @foo(i32* %x) nounwind readnone optsize ssp {
30entry:
31  %cmp = icmp eq i32* %x, @a
32  %conv = zext i1 %cmp to i32
33  ret i32 %conv
34}
35
36define i32 @bar() {
37entry:
38  switch i64 ptrtoint (i32* @b to i64), label %sw.epilog [
39    i64 1, label %return
40    i64 0, label %return
41  ]
42
43sw.epilog:
44  ret i32 0
45
46return:
47  ret i32 1
48}
49
50define i32 @zed() {
51entry:
52  %tmp1 = load i32* @c, align 4
53  ret i32 %tmp1
54}
55