Initial checkin of the "Hello World" Pass.
[oota-llvm.git] / test / opttest.ll
1   const long 12
2
3 implementation
4
5 ulong "const removal"() 
6         const long 12345
7         %q = const uint 4000000000   ; Def %q - uint plane
8         const ulong 123              ; Def 0 - ulong plane
9         const ulong 4000000000000    ; Def 1 - ulong plane
10 begin
11         ret ulong %1
12 end
13
14 void "dce #1"() 
15         const int 0
16 begin
17         ret void
18
19         ret void                    ; Unreachable label
20 end
21
22 void "basic block merge #1"(int %a, uint %b, bool %c, ulong %d) 
23 begin
24         add int %0, %0
25         br label %TestName         ; Can be merged with next block
26 TestName:
27         add uint %0, %0
28         br label %1                 ; Can be merged with next block
29         add ulong %0, %0
30         ret void
31 end
32
33 void "const prop #1"()
34    %x = const int 0                  ; Def %x - int plane
35         const int 0                  ; Def 0 - int plane
36         const bool false
37 begin
38 Startup:
39         %x = seteq int %0, %x
40         br bool %x, label %0, label %Startup  ; Can be eliminated by const prop
41
42         ret void
43 end
44
45 int "const prop #2"()
46 begin
47         %x = add int 1, 1            ; Instrs can be const prop'd away
48         %y = sub int -1, 1
49         %z = add int %x, %y
50         ret int %z                     ; Should equal %0
51 end
52
53 sbyte "const prop #3"()              ; Instrs can be const prop'd away
54 begin
55         %x = add sbyte 127, 127      ; Must wrap around correctly!
56         %y = sub sbyte 1, -1
57         %z = add sbyte %x, %y
58         ret sbyte %z                   ; Should equal %0!
59 end