llvm.org GIT mirror llvm / 11ab0c3
Make "@name =" mandatory for globals in .ll files. An oddity of the .ll syntax is that the "@var = " in @var = global i32 42 is optional. Writing just global i32 42 is equivalent to @0 = global i32 42 This means that there is a pretty big First set at the top level. The current implementation maintains it manually. I was trying to refactor it, but then started wondering why keep it a all. I personally find the above syntax confusing. It looks like something is missing. This patch removes the feature and simplifies the parser. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269096 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
31 changed file(s) with 99 addition(s) and 139 deletion(s). Raw diff Collapse all Expand all
620620
621621 Syntax::
622622
623 [@ =] [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
623 @ = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
624624 [unnamed_addr] [AddrSpace] [ExternallyInitialized]
625625 []
626626 [, section "name"] [, comdat [($name)]]
251251 case lltok::ComdatVar: if (parseComdat()) return true; break;
252252 case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break;
253253 case lltok::MetadataVar:if (ParseNamedMetadata()) return true; break;
254
255 // The Global variable production with no name can have many different
256 // optional leading prefixes, the production is:
257 // GlobalVar ::= OptionalLinkage OptionalVisibility OptionalDLLStorageClass
258 // OptionalThreadLocal OptionalAddrSpace OptionalUnnamedAddr
259 // ('constant'|'global') ...
260 case lltok::kw_private: // OptionalLinkage
261 case lltok::kw_internal: // OptionalLinkage
262 case lltok::kw_weak: // OptionalLinkage
263 case lltok::kw_weak_odr: // OptionalLinkage
264 case lltok::kw_linkonce: // OptionalLinkage
265 case lltok::kw_linkonce_odr: // OptionalLinkage
266 case lltok::kw_appending: // OptionalLinkage
267 case lltok::kw_common: // OptionalLinkage
268 case lltok::kw_extern_weak: // OptionalLinkage
269 case lltok::kw_external: // OptionalLinkage
270 case lltok::kw_default: // OptionalVisibility
271 case lltok::kw_hidden: // OptionalVisibility
272 case lltok::kw_protected: // OptionalVisibility
273 case lltok::kw_dllimport: // OptionalDLLStorageClass
274 case lltok::kw_dllexport: // OptionalDLLStorageClass
275 case lltok::kw_thread_local: // OptionalThreadLocal
276 case lltok::kw_addrspace: // OptionalAddrSpace
277 case lltok::kw_constant: // GlobalType
278 case lltok::kw_global: { // GlobalType
279 unsigned Linkage, Visibility, DLLStorageClass;
280 bool UnnamedAddr;
281 GlobalVariable::ThreadLocalMode TLM;
282 bool HasLinkage;
283 if (ParseOptionalLinkage(Linkage, HasLinkage) ||
284 ParseOptionalVisibility(Visibility) ||
285 ParseOptionalDLLStorageClass(DLLStorageClass) ||
286 ParseOptionalThreadLocal(TLM) ||
287 parseOptionalUnnamedAddr(UnnamedAddr) ||
288 ParseGlobal("", SMLoc(), Linkage, HasLinkage, Visibility,
289 DLLStorageClass, TLM, UnnamedAddr))
290 return true;
291 break;
292 }
293
294254 case lltok::kw_attributes: if (ParseUnnamedAttrGrp()) return true; break;
295255 case lltok::kw_uselistorder: if (ParseUseListOrder()) return true; break;
296256 case lltok::kw_uselistorder_bb:
11 ; RUN: grep "struct initializer doesn't match struct element type" %t
22 ; Test the case of a misformed constant initializer
33 ; This should cause an assembler error, not an assertion failure!
4 constant { i32 } { float 1.0 }
4 @0 = constant { i32 } { float 1.0 }
11 ; RUN: verify-uselistorder %s
22 ; Test that shift instructions can be used in constant expressions.
33
4 global i32 3670016
4 @0 = global i32 3670016
11 ; RUN: not llvm-as < %s > /dev/null 2> %t
22 ; RUN: grep "constexpr requires integer operands" %t
33
4 global i32 ashr (float 1.0, float 2.0)
4 @0 = global i32 ashr (float 1.0, float 2.0)
11 ; RUN: not llvm-as < %s > /dev/null 2> %t
22 ; RUN: grep "initializer with struct type has wrong # elements" %t
33
4 global {} { i32 7, float 1.0, i32 7, i32 8 }
4 @0 = global {} { i32 7, float 1.0, i32 7, i32 8 }
11 ; RUN: verify-uselistorder %s
22
33 @A = external global { float } ; <{ float }*> [#uses=2]
4 global i32* bitcast ({ float }* @A to i32*) ; :0 [#uses=0]
4 @0 = global i32* bitcast ({ float }* @A to i32*) ; :0 [#uses=0]
0 ; RUN: llvm-as < %s | llvm-dis | grep 9223372036854775808
11 ; RUN: verify-uselistorder %s
22
3 global i64 -9223372036854775808
3 @0 = global i64 -9223372036854775808
44
11 ; RUN: verify-uselistorder %s
22
33 ; CHECK: global double -0.000000e+00
4 global double 0x8000000000000000
4 @0 = global double 0x8000000000000000
55
66 ; CHECK: global float -0.000000e+00
7 global float -0.0
7 @1 = global float -0.0
88
22 ; PR3372
33
44 @X = global i32* @0
5 global i32 4
5 @0 = global i32 4
66
55
66 @A = global i64 0
77
8 global i64* inttoptr (i64 add (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X + 0 == X
9 global i64* inttoptr (i64 sub (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X - 0 == X
10 global i64* inttoptr (i64 mul (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X * 0 == 0
11 global i64* inttoptr (i64 sdiv (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X / 1 == X
12 global i64* inttoptr (i64 srem (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X % 1 == 0
13 global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X & 0 == 0
14 global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 -1) to i64*) ; X & -1 == X
15 global i64 or (i64 ptrtoint (i64* @A to i64), i64 -1) ; X | -1 == -1
16 global i64* inttoptr (i64 xor (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X ^ 0 == X
8 @0 = global i64* inttoptr (i64 add (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X + 0 == X
9 @1 = global i64* inttoptr (i64 sub (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X - 0 == X
10 @2 = global i64* inttoptr (i64 mul (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X * 0 == 0
11 @3 = global i64* inttoptr (i64 sdiv (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X / 1 == X
12 @4 = global i64* inttoptr (i64 srem (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X % 1 == 0
13 @5 = global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X & 0 == 0
14 @6 = global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 -1) to i64*) ; X & -1 == X
15 @7 = global i64 or (i64 ptrtoint (i64* @A to i64), i64 -1) ; X | -1 == -1
16 @8 = global i64* inttoptr (i64 xor (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X ^ 0 == X
1717
1818 %Ty = type { i32, i32 }
1919 @B = external global %Ty
2020
21 global i1 icmp slt (i64* @A, i64* getelementptr (i64, i64* @A, i64 1)) ; true
22 global i1 icmp ult (i64* @A, i64* getelementptr (i64, i64* @A, i64 1)) ; true
23 global i1 icmp slt (i64* @A, i64* getelementptr (i64, i64* @A, i64 0)) ; false
24 global i1 icmp slt (i32* getelementptr (%Ty, %Ty* @B, i64 0, i32 0),
21 @9 = global i1 icmp slt (i64* @A, i64* getelementptr (i64, i64* @A, i64 1)) ; true
22 @10 = global i1 icmp ult (i64* @A, i64* getelementptr (i64, i64* @A, i64 1)) ; true
23 @11 = global i1 icmp slt (i64* @A, i64* getelementptr (i64, i64* @A, i64 0)) ; false
24 @12 = global i1 icmp slt (i32* getelementptr (%Ty, %Ty* @B, i64 0, i32 0),
2525 i32* getelementptr (%Ty, %Ty* @B, i64 0, i32 1)) ; true
2626 ;global i1 icmp ne (i64* @A, i64* bitcast (%Ty* @B to i64*)) ; true
2727
2828 ; PR2206
2929 @cons = weak global i32 0, align 8 ; [#uses=1]
30 global i64 and (i64 ptrtoint (i32* @cons to i64), i64 7)
30 @13 = global i64 and (i64 ptrtoint (i32* @cons to i64), i64 7)
3131
32 global <2 x i8*> getelementptr(i8, <2 x i8*> undef, <2 x i64> )
33 global <2 x i8*> getelementptr({ i8 }, <2 x { i8 }*> undef, <2 x i64> , <2 x i32> )
34 global <2 x i8*> getelementptr(i8, <2 x i8*> zeroinitializer, <2 x i64> )
35 global <2 x i8*> getelementptr({ i8 }, <2 x { i8 }*> zeroinitializer, <2 x i64> , <2 x i32> >)
32 @14 = global <2 x i8*> getelementptr(i8, <2 x i8*> undef, <2 x i64> >)
33 @15 = global <2 x i8*> getelementptr({ i8 }, <2 x { i8 }*> undef, <2 x i64> , <2 x i32> )
34 @16 = global <2 x i8*> getelementptr(i8, <2 x i8*> zeroinitializer, <2 x i64> )
35 @17 = global <2 x i8*> getelementptr({ i8 }, <2 x { i8 }*> zeroinitializer, <2 x i64> , <2 x i32> )
11
22 ; CHECK: getelementptr vector index has a wrong number of elements
33
4 global <2 x i32*> getelementptr ([3 x {i32, i32}], <4 x [3 x {i32, i32}]*> zeroinitializer, <2 x i32> , <2 x i32> , <2 x i32> )
4 @0 = global <2 x i32*> getelementptr ([3 x {i32, i32}], <4 x [3 x {i32, i32}]*> zeroinitializer, <2 x i32> , <2 x i32> , <2 x i32> )
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
11
2 global i64 u0x0p001
2 @0 = global i64 u0x0p001
33 ; CHECK: expected value token
0 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
11
22 ; CHECK: invalid cast opcode for cast from 'i64' to 'i64'
3 global i64* inttoptr (i64 0 to i64)
3 @0 = global i64* inttoptr (i64 0 to i64)
1111 ret <4 x i1> %cmp
1212 }
1313
14 global <4 x i1> icmp slt ( <4 x i32> , <4 x i32> )
14 @0 = global <4 x i1> icmp slt ( <4 x i32> , <4 x i32> )
1515 @B = external global i32
16 global <4 x i1> icmp slt ( <4 x i32> , <4 x i32> )
16 @1 = global <4 x i1> icmp slt ( <4 x i32> , <4 x i32> )
1111 %struct.objc_selector = type opaque
1212 %struct.pthread_mutex_t = type { i32, [40 x i8] }
1313 %struct.pthread_rwlock_t = type { i32, [124 x i8] }
14 external constant %struct.__builtin_CFString ; <%struct.__builtin_CFString*>:0 [#uses=1]
14 @0 = external constant %struct.__builtin_CFString ; <%struct.__builtin_CFString*>:0 [#uses=1]
1515
1616 define void @"-[PFTPersistentSymbols saveSymbolWithName:address:path:lineNumber:flags:owner:]"(%struct.PFTPersistentSymbols* %self, %struct.objc_selector* %_cmd, %struct.NSArray* %name, i64 %address, %struct.NSArray* %path, i32 %lineNumber, i64 %flags, %struct..0objc_object* %owner) nounwind {
1717 entry:
33 ; Verify that movups is still generated with an aligned stack for the globals
44 ; that must be accessed unaligned
55
6 external global <4 x float>, align 1 ; <<4 x float>*>:0 [#uses=2]
7 external global <4 x float>, align 1 ; <<4 x float>*>:1 [#uses=1]
8 external global <4 x float>, align 1 ; <<4 x float>*>:2 [#uses=1]
9 external global <4 x float>, align 1 ; <<4 x float>*>:3 [#uses=1]
10 external global <4 x float>, align 1 ; <<4 x float>*>:4 [#uses=1]
11 external global <4 x float>, align 1 ; <<4 x float>*>:5 [#uses=1]
12 external global <4 x float>, align 1 ; <<4 x float>*>:6 [#uses=1]
13 external global <4 x float>, align 1 ; <<4 x float>*>:7 [#uses=1]
14 external global <4 x float>, align 1 ; <<4 x float>*>:8 [#uses=1]
15 external global <4 x float>, align 1 ; <<4 x float>*>:9 [#uses=1]
16 external global <4 x float>, align 1 ; <<4 x float>*>:10 [#uses=1]
17 external global <4 x float>, align 1 ; <<4 x float>*>:11 [#uses=1]
18 external global <4 x float>, align 1 ; <<4 x float>*>:12 [#uses=1]
19 external global <4 x float>, align 1 ; <<4 x float>*>:13 [#uses=1]
20 external global <4 x float>, align 1 ; <<4 x float>*>:14 [#uses=1]
21 external global <4 x float>, align 1 ; <<4 x float>*>:15 [#uses=1]
22 external global <4 x float>, align 1 ; <<4 x float>*>:16 [#uses=1]
23 external global <4 x float>, align 1 ; <<4 x float>*>:17 [#uses=1]
24 external global <4 x float>, align 1 ; <<4 x float>*>:18 [#uses=1]
25 external global <4 x float>, align 1 ; <<4 x float>*>:19 [#uses=1]
26 external global <4 x float>, align 1 ; <<4 x float>*>:20 [#uses=1]
27 external global <4 x float>, align 1 ; <<4 x float>*>:21 [#uses=1]
28 external global <4 x float>, align 1 ; <<4 x float>*>:22 [#uses=1]
29 external global <4 x float>, align 1 ; <<4 x float>*>:23 [#uses=1]
30 external global <4 x float>, align 1 ; <<4 x float>*>:24 [#uses=1]
31 external global <4 x float>, align 1 ; <<4 x float>*>:25 [#uses=1]
32 external global <4 x float>, align 1 ; <<4 x float>*>:26 [#uses=1]
33 external global <4 x float>, align 1 ; <<4 x float>*>:27 [#uses=1]
34 external global <4 x float>, align 1 ; <<4 x float>*>:28 [#uses=1]
35 external global <4 x float>, align 1 ; <<4 x float>*>:29 [#uses=1]
36 external global <4 x float>, align 1 ; <<4 x float>*>:30 [#uses=1]
37 external global <4 x float>, align 1 ; <<4 x float>*>:31 [#uses=1]
6 @0 = external global <4 x float>, align 1 ; <<4 x float>*>:0 [#uses=2]
7 @1 = external global <4 x float>, align 1 ; <<4 x float>*>:1 [#uses=1]
8 @2 = external global <4 x float>, align 1 ; <<4 x float>*>:2 [#uses=1]
9 @3 = external global <4 x float>, align 1 ; <<4 x float>*>:3 [#uses=1]
10 @4 = external global <4 x float>, align 1 ; <<4 x float>*>:4 [#uses=1]
11 @5 = external global <4 x float>, align 1 ; <<4 x float>*>:5 [#uses=1]
12 @6 = external global <4 x float>, align 1 ; <<4 x float>*>:6 [#uses=1]
13 @7 = external global <4 x float>, align 1 ; <<4 x float>*>:7 [#uses=1]
14 @8 = external global <4 x float>, align 1 ; <<4 x float>*>:8 [#uses=1]
15 @9 = external global <4 x float>, align 1 ; <<4 x float>*>:9 [#uses=1]
16 @10 = external global <4 x float>, align 1 ; <<4 x float>*>:10 [#uses=1]
17 @11 = external global <4 x float>, align 1 ; <<4 x float>*>:11 [#uses=1]
18 @12 = external global <4 x float>, align 1 ; <<4 x float>*>:12 [#uses=1]
19 @13 = external global <4 x float>, align 1 ; <<4 x float>*>:13 [#uses=1]
20 @14 = external global <4 x float>, align 1 ; <<4 x float>*>:14 [#uses=1]
21 @15 = external global <4 x float>, align 1 ; <<4 x float>*>:15 [#uses=1]
22 @16 = external global <4 x float>, align 1 ; <<4 x float>*>:16 [#uses=1]
23 @17 = external global <4 x float>, align 1 ; <<4 x float>*>:17 [#uses=1]
24 @18 = external global <4 x float>, align 1 ; <<4 x float>*>:18 [#uses=1]
25 @19 = external global <4 x float>, align 1 ; <<4 x float>*>:19 [#uses=1]
26 @20 = external global <4 x float>, align 1 ; <<4 x float>*>:20 [#uses=1]
27 @21 = external global <4 x float>, align 1 ; <<4 x float>*>:21 [#uses=1]
28 @22 = external global <4 x float>, align 1 ; <<4 x float>*>:22 [#uses=1]
29 @23 = external global <4 x float>, align 1 ; <<4 x float>*>:23 [#uses=1]
30 @24 = external global <4 x float>, align 1 ; <<4 x float>*>:24 [#uses=1]
31 @25 = external global <4 x float>, align 1 ; <<4 x float>*>:25 [#uses=1]
32 @26 = external global <4 x float>, align 1 ; <<4 x float>*>:26 [#uses=1]
33 @27 = external global <4 x float>, align 1 ; <<4 x float>*>:27 [#uses=1]
34 @28 = external global <4 x float>, align 1 ; <<4 x float>*>:28 [#uses=1]
35 @29 = external global <4 x float>, align 1 ; <<4 x float>*>:29 [#uses=1]
36 @30 = external global <4 x float>, align 1 ; <<4 x float>*>:30 [#uses=1]
37 @31 = external global <4 x float>, align 1 ; <<4 x float>*>:31 [#uses=1]
3838
3939 declare void @abort()
4040
0 ; RUN: llc < %s -march=x86 -mattr=+sse2
11 ; PR2566
22
3 external global i16 ; :0 [#uses=1]
4 external global <4 x i16> ; <<4 x i16>*>:1 [#uses=1]
3 @0 = external global i16 ; :0 [#uses=1]
4 @1 = external global <4 x i16> ; <<4 x i16>*>:1 [#uses=1]
55
66 declare void @abort()
77
44 %struct.XCStringList = type { i32, %struct._XCStringListNode* }
55 %struct._XCStringListNode = type { [3 x i8], [0 x i8], i8 }
66 %struct.__builtin_CFString = type { i32*, i32, i8*, i32 }
7 internal constant %struct.__builtin_CFString { i32* getelementptr ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr ([3 x i8], [3 x i8]* @"\01LC", i32 0, i32 0), i32 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1]
7 @0 = internal constant %struct.__builtin_CFString { i32* getelementptr ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr ([3 x i8], [3 x i8]* @"\01LC", i32 0, i32 0), i32 2 } ; <%struct.__builtin_CFString*>:0 [#uses=1]
88 @__CFConstantStringClassReference = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
99 @"\01LC" = internal constant [3 x i8] c"NO\00" ; <[3 x i8]*> [#uses=1]
1010 @"\01LC1" = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
11
22 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"
33 target triple = "x86_64-unknown-linux-gnu"
4 external global i32 ; :0 [#uses=1]
4 @0 = external global i32 ; :0 [#uses=1]
55
66 declare i64 @strlen(i8* nocapture) nounwind readonly
77
33 ; RUN: grep "extractps \$1, %xmm0, " %t | count 1
44 ; PR2647
55
6 external global float, align 16 ; :0 [#uses=2]
6 @0 = external global float, align 16 ; :0 [#uses=2]
77
88 define internal void @""() nounwind {
99 load float, float* @0, align 16 ; :1 [#uses=1]
11 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X32
22 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64
33
4 external constant <4 x i32> ; <<4 x i32>*>:0 [#uses=1]
5 external constant <4 x i16> ; <<4 x i16>*>:1 [#uses=1]
4 @0 = external constant <4 x i32> ; <<4 x i32>*>:0 [#uses=1]
5 @1 = external constant <4 x i16> ; <<4 x i16>*>:1 [#uses=1]
66
77 define internal void @PR2585() {
88 ; X32-LABEL: PR2585:
99 ;; Test constant cast expressions
1010 ;;-------------------------------
1111
12 global i64 u0x00001 ; hexadecimal unsigned integer constants
13 global i64 s0x0012312 ; hexadecimal signed integer constants
12 @0 = global i64 u0x00001 ; hexadecimal unsigned integer constants
13 @1 = global i64 s0x0012312 ; hexadecimal signed integer constants
1414
1515 @t2 = global i32* @t1 ;; Forward reference without cast
1616 @t3 = global i32* bitcast (i32* @t1 to i32*) ;; Forward reference with cast
2121 @t7 = global float* inttoptr (i32 12345678 to float*) ;; Cast ordinary value to ptr
2222 @t9 = global i32 bitcast (float bitcast (i32 8 to float) to i32) ;; Nested cast expression
2323
24 global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference
25 global float* @4 ;; Duplicate forward numeric reference
26 global float 0.0
24 @2 = global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference
25 @3 = global float* @4 ;; Duplicate forward numeric reference
26 @4 = global float 0.0
2727
2828
2929 ;;---------------------------------------------------
1515
1616 @t2 = global i32* @t1
1717
18 global float * @2 ;; Forward numeric reference
19 global float * @2 ;; Duplicate forward numeric reference
20 global float 0.0
21 global float * @2 ;; Numeric reference
18 @0 = global float * @2 ;; Forward numeric reference
19 @1 = global float * @2 ;; Duplicate forward numeric reference
20 @2 = global float 0.0
21 @3 = global float * @2 ;; Numeric reference
2222
2323
2424 @fptr = global void() * @f ;; Forward ref method defn
33
44 @MyVar = external global i32 ; [#uses=1]
55 @MyIntList = external global { i32*, i32 } ; <{ \2*, i32 }*> [#uses=1]
6 external global i32 ; :0 [#uses=0]
6 @0 = external global i32 ; :0 [#uses=0]
77 @AConst = constant i32 123 ; [#uses=0]
88 @AString = constant [4 x i8] c"test" ; <[4 x i8]*> [#uses=0]
99 @ZeroInit = global { [100 x i32], [40 x float] } zeroinitializer ; <{ [100 x i32], [40 x float] }*> [#uses=0]
1515 ret i32 %blah
1616 }
1717
18 hidden dllexport global i32 42
19 dllexport global i32 42
18 @1 = hidden dllexport global i32 42
19 @2 = dllexport global i32 42
33
44 @somestr = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=1]
55 @array = constant [2 x i32] [ i32 12, i32 52 ] ; <[2 x i32]*> [#uses=1]
6 constant { i32, i32 } { i32 4, i32 3 } ; <{ i32, i32 }*>:0 [#uses=0]
6 @0 = constant { i32, i32 } { i32 4, i32 3 } ; <{ i32, i32 }*>:0 [#uses=0]
77
88 define [2 x i32]* @testfunction(i32 %i0, i32 %j0) {
99 ret [2 x i32]* @array
1010 ;; Test constant cast expressions
1111 ;;-------------------------------
1212
13 global i63 u0x00001 ; hexadecimal unsigned integer constants
14 global i63 s0x012312 ; hexadecimal signed integer constants
13 @0 = global i63 u0x00001 ; hexadecimal unsigned integer constants
14 @1 = global i63 s0x012312 ; hexadecimal signed integer constants
1515
1616 @t2 = global i33* @t1 ;; Forward reference without cast
1717 @t3 = global i33* bitcast (i33* @t1 to i33*) ;; Forward reference with cast
2323 @t9 = global i33 fptosi (float sitofp (i33 8 to float) to i33) ;; Nested cast expression
2424
2525
26 global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference
27 global float* @4 ;; Duplicate forward numeric reference
28 global float 0.0
26 @2 = global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference
27 @3 = global float* @4 ;; Duplicate forward numeric reference
28 @4 = global float 0.0
2929
3030
3131 ;;---------------------------------------------------
1515
1616 @t2 = global i40 * @t1
1717
18 global float * @2 ;; Forward numeric reference
19 global float * @2 ;; Duplicate forward numeric reference
20 global float 0.0
21 global float * @2 ;; Numeric reference
18 @0 = global float * @2 ;; Forward numeric reference
19 @1 = global float * @2 ;; Duplicate forward numeric reference
20 @2 = global float 0.0
21 @3 = global float * @2 ;; Numeric reference
2222
2323
2424 @fptr = global void() * @f ;; Forward ref method defn
44 %M = type opaque
55
66 ; GLobal using the resolved function prototype
7 global void (%M*)* @foo ; :0 [#uses=0]
7 @0 = global void (%M*)* @foo ; :0 [#uses=0]
88
99 define void @foo.upgrd.1(i32* %V) {
1010 ret void
77 %struct.__builtin_CFString = type { i32*, i32, i8*, i32 }
88 @_ZZ19SFLGetVisibilityKeyvE19_kSFLLVisibilityKey = internal global %struct.__CFString* null ; <%struct.__CFString**> [#uses=2]
99 @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey = internal global %struct.__CFString* null ; <%struct.__CFString**> [#uses=7]
10 internal constant %struct.__builtin_CFString {
10 @0 = internal constant %struct.__builtin_CFString {
1111 i32* getelementptr ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0),
1212 i32 1992,
1313 i8* getelementptr ([14 x i8], [14 x i8]* @.str, i32 0, i32 0),
0 ; RUN: opt < %s -globalopt -S | FileCheck %s
11
2 global i32 0
2 @0 = global i32 0
33 ; CHECK-DAG: @0 = internal global i32 0
44
5 private global i32 0
5 @1 = private global i32 0
66 ; CHECK-DAG: @1 = private global i32 0
77
88 define i32* @2() {