Duncan P. N. Exon Smith | 0a448fb | 2014-08-19 21:30:15 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s -disable-output 2>&1 | FileCheck %s -allow-empty |
| 2 | ; CHECK-NOT: error |
| 3 | ; CHECK-NOT: warning |
| 4 | ; RUN: verify-uselistorder < %s |
| 5 | |
| 6 | @a = global [4 x i1] [i1 0, i1 1, i1 0, i1 1] |
David Blaikie | 2f40830 | 2015-09-11 03:22:04 +0000 | [diff] [blame] | 7 | @b = alias i1, getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2) |
Duncan P. N. Exon Smith | 0a448fb | 2014-08-19 21:30:15 +0000 | [diff] [blame] | 8 | |
| 9 | ; Check use-list order of constants used by globals. |
| 10 | @glob1 = global i5 7 |
| 11 | @glob2 = global i5 7 |
| 12 | @glob3 = global i5 7 |
| 13 | |
| 14 | define i32 @f32(i32 %a, i32 %b, i32 %c, i32 %d) { |
| 15 | entry: |
| 16 | br label %first |
| 17 | |
| 18 | ; <label 0>: |
| 19 | %eh = mul i32 %e, %1 |
| 20 | %sum = add i32 %eh, %ef |
| 21 | br label %preexit |
| 22 | |
| 23 | preexit: |
| 24 | %product = phi i32 [%ef, %first], [%sum, %0] |
| 25 | %backto0 = icmp slt i32 %product, -9 |
| 26 | br i1 %backto0, label %0, label %exit |
| 27 | |
| 28 | exit: |
| 29 | ret i32 %product |
| 30 | |
| 31 | first: |
| 32 | %e = add i32 %a, 7 |
| 33 | %f = add i32 %b, 7 |
| 34 | %g = add i32 %c, 8 |
| 35 | %1 = add i32 %d, 8 |
| 36 | %ef = mul i32 %e, %f |
| 37 | %g1 = mul i32 %g, %1 |
| 38 | %goto0 = icmp slt i32 %g1, -9 |
| 39 | br i1 %goto0, label %0, label %preexit |
| 40 | |
| 41 | ; uselistorder directives |
| 42 | uselistorder i32 7, { 1, 0 } |
| 43 | uselistorder i32 %1, { 1, 0 } |
| 44 | uselistorder i32 %e, { 1, 0 } |
| 45 | uselistorder label %0, { 1, 0 } |
| 46 | uselistorder label %preexit, { 1, 0 } |
| 47 | } |
| 48 | |
| 49 | define i1 @loada() { |
| 50 | entry: |
David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 51 | %a = load i1, i1* getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2) |
Duncan P. N. Exon Smith | 0a448fb | 2014-08-19 21:30:15 +0000 | [diff] [blame] | 52 | ret i1 %a |
| 53 | } |
| 54 | |
| 55 | uselistorder i5 7, { 1, 0, 2 } |
David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 56 | uselistorder i1* getelementptr ([4 x i1], [4 x i1]* @a, i64 0, i64 2), { 1, 0 } |