| 1 |
// RUN: %clang_cc1 -triple spir64-unknown-unknown -cl-std=CL2.0 -O0 -debug-info-kind=standalone -gno-column-info -emit-llvm-bc %s -o %t.bc |
| 2 |
// RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_unstructured_loop_controls -o %t.spv |
| 3 |
// RUN: llvm-spirv %t.spv --to-text -o %t.spt |
| 4 |
// RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV |
| 5 |
// RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.bc |
| 6 |
// RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 7 |
|
| 8 |
// Test that no debug info instruction is inserted between LoopControlINTEL and |
| 9 |
// Branch instructions. Otherwise, debug info interferes with SPIRVToLLVM |
| 10 |
// translation of structured flow control |
| 11 |
|
| 12 |
kernel |
| 13 |
void sample() { |
| 14 |
#pragma clang loop unroll(full) |
| 15 |
for(;;); |
| 16 |
} |
| 17 |
|
| 18 |
// Check that all Line items are retained |
| 19 |
// CHECK-SPIRV: Line [[File:[0-9]+]] 15 0 |
| 20 |
// Loop control |
| 21 |
// CHECK-SPIRV: LoopControlINTEL 257 1 |
| 22 |
// CHECK-SPIRV-NEXT: Branch |
| 23 |
|
| 24 |
// CHECK-LLVM: br label %{{.*}}, !dbg !{{[0-9]+}}, !llvm.loop ![[MD:[0-9]+]] |
| 25 |
// CHECK-LLVM: ![[MD]] = distinct !{![[MD]], ![[MD_unroll:[0-9]+]]} |
| 26 |
// CHECK-LLVM: ![[MD_unroll]] = !{!"llvm.loop.unroll.full"} |