|
| 1 | +; Test "llvm.loop.estimated_trip_count" validation |
| 2 | + |
| 3 | +; DEFINE: %{RUN} = opt -passes=verify %t -disable-output 2>&1 | \ |
| 4 | +; DEFINE: FileCheck %s -allow-empty -check-prefix |
| 5 | + |
| 6 | +define void @test() { |
| 7 | +entry: |
| 8 | + br label %body |
| 9 | +body: |
| 10 | + br i1 0, label %body, label %exit, !llvm.loop !0 |
| 11 | +exit: |
| 12 | + ret void |
| 13 | +} |
| 14 | +!0 = distinct !{!0, !1} |
| 15 | + |
| 16 | +; GOOD-NOT: {{.}} |
| 17 | + |
| 18 | +; BAD-VALUE: Expected optional second operand to be an integer constant of type i32 or smaller |
| 19 | +; BAD-VALUE-NEXT: !1 = !{!"llvm.loop.estimated_trip_count", |
| 20 | + |
| 21 | +; TOO-MANY: Expected one or two operands |
| 22 | +; TOO-MANY-NEXT: !1 = !{!"llvm.loop.estimated_trip_count", i32 5, i32 5} |
| 23 | + |
| 24 | +; No value. |
| 25 | +; RUN: cp %s %t |
| 26 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count"}' >> %t |
| 27 | +; RUN: %{RUN} GOOD |
| 28 | + |
| 29 | +; i16 value. |
| 30 | +; RUN: cp %s %t |
| 31 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", i16 5}' >> %t |
| 32 | +; RUN: %{RUN} GOOD |
| 33 | + |
| 34 | +; i32 value. |
| 35 | +; RUN: cp %s %t |
| 36 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", i32 5}' >> %t |
| 37 | +; RUN: %{RUN} GOOD |
| 38 | + |
| 39 | +; i64 value. |
| 40 | +; RUN: cp %s %t |
| 41 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", i64 5}' >> %t |
| 42 | +; RUN: not %{RUN} BAD-VALUE |
| 43 | + |
| 44 | +; MDString value. |
| 45 | +; RUN: cp %s %t |
| 46 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", !"5"}' >> %t |
| 47 | +; RUN: not %{RUN} BAD-VALUE |
| 48 | + |
| 49 | +; MDNode value. |
| 50 | +; RUN: cp %s %t |
| 51 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", !2}' >> %t |
| 52 | +; RUN: echo '!2 = !{i32 5}' >> %t |
| 53 | +; RUN: not %{RUN} BAD-VALUE |
| 54 | + |
| 55 | +; Too many values. |
| 56 | +; RUN: cp %s %t |
| 57 | +; RUN: echo '!1 = !{!"llvm.loop.estimated_trip_count", i32 5, i32 5}' >> %t |
| 58 | +; RUN: not %{RUN} TOO-MANY |
0 commit comments