|
| 1 | +; Test if llvm-spirv type scavenging has an assertion |
| 2 | +; failure due to incorrect lookup of an equivalence class leader. |
| 3 | + |
| 4 | +; RUN: llvm-as < %s | llvm-spirv -o %t.spv |
| 5 | +; RUN: spirv-val %t.spv |
| 6 | +; RUN: llvm-spirv %t.spv -o - -to-text | FileCheck %s --check-prefix=CHECK-SPIRV |
| 7 | +; RUN: llvm-spirv %t.spv -o - -r | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM |
| 8 | + |
| 9 | +; Incorrect lookup of equivalence class leader caused an assertion failure when |
| 10 | +; processing call instruction to this name |
| 11 | +; CHECK-SPIRV: _func0 |
| 12 | +; CHECK-LLVM: _func0 |
| 13 | + |
| 14 | +target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 15 | +target triple = "spir64-unknown-unknown" |
| 16 | + |
| 17 | +define spir_func void @_func1() { |
| 18 | +entry: |
| 19 | + br label %for.cond |
| 20 | + |
| 21 | +for.cond: ; preds = %for.cond, %entry |
| 22 | + %call3 = call spir_func ptr addrspace(4) @_func2() |
| 23 | + %call5 = call spir_func ptr addrspace(4) @_func0(ptr addrspace(4) %call3, i64 0) |
| 24 | + br label %for.cond |
| 25 | +} |
| 26 | + |
| 27 | +define spir_func void @_func3() { |
| 28 | +entry: |
| 29 | + br label %for.cond |
| 30 | + |
| 31 | +for.cond: ; preds = %for.cond, %entry |
| 32 | + %call3 = call spir_func ptr @_func4() |
| 33 | + %call3.ascast = addrspacecast ptr %call3 to ptr addrspace(4) |
| 34 | + %call5 = call spir_func ptr addrspace(4) @_func0(ptr addrspace(4) %call3.ascast, i64 0) |
| 35 | + br label %for.cond |
| 36 | +} |
| 37 | + |
| 38 | +declare spir_func ptr addrspace(4) @_func5() |
| 39 | + |
| 40 | +define spir_func void @_func6(ptr addrspace(4) %call3.ascast) { |
| 41 | +entry: |
| 42 | + br label %for.cond |
| 43 | + |
| 44 | +for.cond: ; preds = %for.cond, %entry |
| 45 | + %call5 = call spir_func ptr addrspace(4) @_func0(ptr addrspace(4) %call3.ascast, i64 0) |
| 46 | + br label %for.cond |
| 47 | +} |
| 48 | + |
| 49 | +define spir_func void @_func7() { |
| 50 | +entry: |
| 51 | + br label %for.cond |
| 52 | + |
| 53 | +for.cond: ; preds = %for.cond, %entry |
| 54 | + %call3 = call spir_func ptr addrspace(4) @_func5() |
| 55 | + %call5 = call spir_func ptr addrspace(4) @_func0(ptr addrspace(4) %call3, i64 0) |
| 56 | + br label %for.cond |
| 57 | +} |
| 58 | + |
| 59 | +declare spir_func ptr @_func4() |
| 60 | + |
| 61 | +declare spir_func ptr addrspace(4) @_func2() |
| 62 | + |
| 63 | +define spir_func ptr addrspace(4) @_func0(ptr addrspace(4) %this, i64 %index) { |
| 64 | +entry: |
| 65 | + %arrayidx = getelementptr [5 x i32], ptr addrspace(4) %this, i64 0, i64 %index |
| 66 | + ret ptr addrspace(4) null |
| 67 | +} |
| 68 | + |
| 69 | +define spir_func void @_func8() { |
| 70 | +entry: |
| 71 | + br label %for.cond |
| 72 | + |
| 73 | +for.cond: ; preds = %for.cond, %entry |
| 74 | + %call8 = call spir_func ptr addrspace(4) @_func0(ptr addrspace(4) null, i64 0) |
| 75 | + br label %for.cond |
| 76 | +} |
| 77 | + |
| 78 | +; uselistorder directives |
| 79 | +uselistorder ptr @_func0, { 0, 4, 3, 2, 1 } |
0 commit comments