| Chris Lattner | df8fcca | 2002-04-28 01:46:36 +0000 | [diff] [blame^] | 1 | ; Various test cases to ensure basic functionality is working for GCSE |
| 2 | |
| 3 | ; RUN: as < %s | opt -gcse |
| 4 | |
| 5 | implementation |
| 6 | |
| 7 | void "testinsts"(int %i, int %j, int* %p) |
| 8 | begin |
| 9 | %A = cast int %i to uint |
| 10 | %B = cast int %i to uint |
| 11 | |
| 12 | %C = shl int %i, ubyte 1 |
| 13 | %D = shl int %i, ubyte 1 |
| 14 | |
| 15 | %E = getelementptr int* %p, uint 12 |
| 16 | %F = getelementptr int* %p, uint 12 |
| 17 | %G = getelementptr int* %p, uint 13 |
| 18 | ret void |
| 19 | end |
| 20 | |
| 21 | |
| 22 | ; Test different combinations of domination properties... |
| 23 | void "sameBBtest"(int %i, int %j) |
| 24 | begin |
| 25 | %A = add int %i, %j |
| 26 | %B = add int %i, %j |
| 27 | |
| 28 | %C = not int %A |
| 29 | %D = not int %B |
| 30 | %E = not int %j |
| 31 | |
| 32 | ret void |
| 33 | end |
| 34 | |
| 35 | int "dominates"(int %i, int %j) |
| 36 | begin |
| 37 | %A = add int %i, %j |
| 38 | br label %BB2 |
| 39 | |
| 40 | BB2: |
| 41 | %B = add int %i, %j |
| 42 | ret int %B |
| 43 | end |
| 44 | |
| 45 | int "hascommondominator"(int %i, int %j) |
| 46 | begin |
| 47 | br bool true, label %BB1, label %BB2 |
| 48 | |
| 49 | BB1: |
| 50 | %A = add int %i, %j |
| 51 | ret int %A |
| 52 | |
| 53 | BB2: |
| 54 | %B = add int %i, %j |
| 55 | ret int %B |
| 56 | end |
| 57 | |