blob: a98a68ef1f967e36aa7991901cadb6dac38138a1 [file] [log] [blame]
John Criswell57886cb2003-07-21 19:41:51 +00001;
2; Test: ExternalConstant
3;
4; Description:
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.
8;
9; If a problem occurs, we should die on an assert(). Otherwise, we
10; should pass through the optimizer without failure.
11;
12; Extra code:
13; RUN: as < %s | opt -instcombine
14;
15
16target endian = little
17target pointersize = 32
18%silly = external constant int ; <int*> [#uses=1]
19
20implementation ; Functions:
21
22declare void %bzero(sbyte*, uint)
23
24declare void %bcopy(sbyte*, sbyte*, uint)
25
26declare int %bcmp(sbyte*, sbyte*, uint)
27
28declare int %fputs(sbyte*, sbyte*)
29
30declare int %fputs_unlocked(sbyte*, sbyte*)
31
32int %function(int %a.1) {
33entry: ; 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
41 br label %return
42
43return: ; preds = %entry
44 %tmp.3 = load int* %result ; <int> [#uses=1]
45 ret int %tmp.3
46}