~ubuntu-branches/ubuntu/quantal/llvm-3.1/quantal

« back to all changes in this revision

Viewing changes to test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-03-29 19:09:51 UTC
  • Revision ID: package-import@ubuntu.com-20120329190951-aq83ivog4cg8bxun
Tags: upstream-3.1~svn153643
ImportĀ upstreamĀ versionĀ 3.1~svn153643

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;
 
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: opt < %s -instcombine
 
14
; END.
 
15
 
 
16
target datalayout = "e-p:32:32"
 
17
@silly = external constant i32          ; <i32*> [#uses=1]
 
18
 
 
19
declare void @bzero(i8*, i32)
 
20
 
 
21
declare void @bcopy(i8*, i8*, i32)
 
22
 
 
23
declare i32 @bcmp(i8*, i8*, i32)
 
24
 
 
25
declare i32 @fputs(i8*, i8*)
 
26
 
 
27
declare i32 @fputs_unlocked(i8*, i8*)
 
28
 
 
29
define i32 @function(i32 %a.1) {
 
30
entry:
 
31
        %a.0 = alloca i32               ; <i32*> [#uses=2]
 
32
        %result = alloca i32            ; <i32*> [#uses=2]
 
33
        store i32 %a.1, i32* %a.0
 
34
        %tmp.0 = load i32* %a.0         ; <i32> [#uses=1]
 
35
        %tmp.1 = load i32* @silly               ; <i32> [#uses=1]
 
36
        %tmp.2 = add i32 %tmp.0, %tmp.1         ; <i32> [#uses=1]
 
37
        store i32 %tmp.2, i32* %result
 
38
        br label %return
 
39
 
 
40
return:         ; preds = %entry
 
41
        %tmp.3 = load i32* %result              ; <i32> [#uses=1]
 
42
        ret i32 %tmp.3
 
43
}
 
44