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: as < %s | opt -instcombine
16 target endian = little
17 target pointersize = 32
18 %silly = external constant int ; <int*> [#uses=1]
20 implementation ; Functions:
22 declare void %bzero(sbyte*, uint)
24 declare void %bcopy(sbyte*, sbyte*, uint)
26 declare int %bcmp(sbyte*, sbyte*, uint)
28 declare int %fputs(sbyte*, sbyte*)
30 declare int %fputs_unlocked(sbyte*, sbyte*)
32 int %function(int %a.1) {
33 entry: ; No predecessors!
34 %a.0 = alloca int ; <int*> [#uses=2]
35 %result = alloca int ; <int*> [#uses=2]
36 store int %a.1, int* %a.0
37 %tmp.0 = load int* %a.0 ; <int> [#uses=1]
38 %tmp.1 = load int* %silly ; <int> [#uses=1]
39 %tmp.2 = add int %tmp.0, %tmp.1 ; <int> [#uses=1]
40 store int %tmp.2, int* %result
43 return: ; preds = %entry
44 %tmp.3 = load int* %result ; <int> [#uses=1]