blob: 4296b2d427a66dfe3fff29e94f2e646190370ab8 [file] [log] [blame]
Chris Lattner02a9c0a2001-10-03 01:48:04 +00001 const long 12
Chris Lattner2f7c9632001-06-06 20:29:01 +00002
3implementation
4
5ulong "const removal"()
Chris Lattner02a9c0a2001-10-03 01:48:04 +00006 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
Chris Lattner2f7c9632001-06-06 20:29:01 +000010begin
11 ret ulong %1
12end
13
14void "dce #1"()
Chris Lattner02a9c0a2001-10-03 01:48:04 +000015 const int 0
Chris Lattner2f7c9632001-06-06 20:29:01 +000016begin
17 ret void
18
19 ret void ; Unreachable label
20end
21
22void "basic block merge #1"(int %a, uint %b, bool %c, ulong %d)
23begin
24 add int %0, %0
25 br label %TestName ; Can be merged with next block
26TestName:
27 add uint %0, %0
28 br label %1 ; Can be merged with next block
29 add ulong %0, %0
30 ret void
31end
32
33void "const prop #1"()
Chris Lattner02a9c0a2001-10-03 01:48:04 +000034 %x = const int 0 ; Def %x - int plane
35 const int 0 ; Def 0 - int plane
36 const bool false
Chris Lattner2f7c9632001-06-06 20:29:01 +000037begin
38Startup:
39 %x = seteq int %0, %x
40 br bool %x, label %0, label %Startup ; Can be eliminated by const prop
41
42 ret void
43end
44
45int "const prop #2"()
46begin
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
51end
52
53sbyte "const prop #3"() ; Instrs can be const prop'd away
54begin
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!
59end