2 ; Test: ExternalConstant
5 ; This regression test helps check whether the instruction combining
6 ; optimization pass correctly handles global variables which are marked
7 ; as external and constant.
9 ; If a problem occurs, we should die on an assert(). Otherwise, we
10 ; should pass through the optimizer without failure.
13 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine
17 target endian = little
18 target pointersize = 32
19 %silly = external constant int ; <int*> [#uses=1]
21 implementation ; Functions:
23 declare void %bzero(sbyte*, uint)
25 declare void %bcopy(sbyte*, sbyte*, uint)
27 declare int %bcmp(sbyte*, sbyte*, uint)
29 declare int %fputs(sbyte*, sbyte*)
31 declare int %fputs_unlocked(sbyte*, sbyte*)
33 int %function(int %a.1) {
34 entry: ; No predecessors!
35 %a.0 = alloca int ; <int*> [#uses=2]
36 %result = alloca int ; <int*> [#uses=2]
37 store int %a.1, int* %a.0
38 %tmp.0 = load int* %a.0 ; <int> [#uses=1]
39 %tmp.1 = load int* %silly ; <int> [#uses=1]
40 %tmp.2 = add int %tmp.0, %tmp.1 ; <int> [#uses=1]
41 store int %tmp.2, int* %result
44 return: ; preds = %entry
45 %tmp.3 = load int* %result ; <int> [#uses=1]