• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S < %s -globalopt | FileCheck %s
2
3@G = internal global i32 42
4
5define i8 @f() norecurse {
6; CHECK-LABEL: @f
7; CHECK: alloca
8; CHECK-NOT: @G
9; CHECK: }
10  store i32 42, i32* @G
11  %a = load i8, i8* bitcast (i32* @G to i8*)
12  ret i8 %a
13}
14
15@H = internal global i32 42
16@Halias = alias i32, i32* @H
17
18; @H can't be localized because @Halias uses it, and @Halias can't be converted to an instruction.
19define i8 @g() norecurse {
20; CHECK-LABEL: @g
21; CHECK-NOT: alloca
22; CHECK: @H
23; CHECK: }
24  store i32 42, i32* @H
25  %a = load i8, i8* bitcast (i32* @H to i8*)
26  ret i8 %a
27}
28
29