|
| 1 | +; RUN: not %dxopt %s -hlsl-passes-resume -hlmatrixlower -S | FileCheck %s |
| 2 | + |
| 3 | + |
| 4 | +; The HL matrix lowering pass can sometimes throw an exception |
| 5 | +; due to an invalid LLVM-level cast<Ty> call. Make sure that |
| 6 | +; propagates out to a user-level error. |
| 7 | + |
| 8 | +; Note: There is still a bug in the compiler here. Not all matrix |
| 9 | +; lowerings are covered by the pass. |
| 10 | + |
| 11 | +; TODO: Fix the underlying bug https://github.com/microsoft/DirectXShaderCompiler/issues/6723 |
| 12 | +; Once that is fixed, this test changes or should be deleted. |
| 13 | + |
| 14 | + |
| 15 | +; CHECK: Operation failed - error code |
| 16 | + |
| 17 | +; |
| 18 | +; Buffer Definitions: |
| 19 | +; |
| 20 | +; cbuffer $Globals |
| 21 | +; { |
| 22 | +; |
| 23 | +; [0 x i8] (type annotation not present) |
| 24 | +; |
| 25 | +; } |
| 26 | +; |
| 27 | +; |
| 28 | +; Resource Bindings: |
| 29 | +; |
| 30 | +; Name Type Format Dim ID HLSL Bind Count |
| 31 | +; ------------------------------ ---------- ------- ----------- ------- -------------- ------ |
| 32 | +; $Globals cbuffer NA NA CB0 cb4294967295 1 |
| 33 | +; |
| 34 | +target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64" |
| 35 | +target triple = "dxil-ms-dx" |
| 36 | + |
| 37 | +%ConstantBuffer = type opaque |
| 38 | +%class.matrix.float.2.4 = type { [2 x <4 x float>] } |
| 39 | +%struct.e = type { [1 x %struct.d], [1 x %struct.d] } |
| 40 | +%struct.d = type { %struct.a } |
| 41 | +%struct.a = type { float, %class.matrix.float.2.4 } |
| 42 | + |
| 43 | +@"$Globals" = external constant %ConstantBuffer |
| 44 | +@g.0.0.0 = internal global [1 x float] undef, align 4 |
| 45 | +@g.0.0.1 = internal global [1 x %class.matrix.float.2.4] undef, align 4 |
| 46 | +@g.1.0.0 = internal global [1 x float] undef, align 4 |
| 47 | +@g.1.0.1 = internal global [1 x %class.matrix.float.2.4] undef, align 4 |
| 48 | + |
| 49 | +; Function Attrs: nounwind |
| 50 | +define void @main() #0 { |
| 51 | +entry: |
| 52 | + %h.0.1 = alloca %class.matrix.float.2.4, !dbg !26 ; line:13 col:17 |
| 53 | + store float 0.000000e+00, float* getelementptr inbounds ([1 x float], [1 x float]* @g.0.0.0, i32 0, i32 0), !dbg !26 ; line:13 col:17 |
| 54 | + %0 = call %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32 0, <8 x float> zeroinitializer) #0, !dbg !26 ; line:13 col:17 |
| 55 | + %1 = call %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32 7, %class.matrix.float.2.4 %0) #0, !dbg !26 ; line:13 col:17 |
| 56 | + %2 = call %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32 1, %class.matrix.float.2.4* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.0.0.1, i32 0, i32 0), %class.matrix.float.2.4 %1) #0, !dbg !26 ; line:13 col:17 |
| 57 | + store float 0.000000e+00, float* getelementptr inbounds ([1 x float], [1 x float]* @g.1.0.0, i32 0, i32 0), !dbg !26 ; line:13 col:17 |
| 58 | + %3 = call %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32 0, <8 x float> zeroinitializer) #0, !dbg !26 ; line:13 col:17 |
| 59 | + %4 = call %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32 7, %class.matrix.float.2.4 %3) #0, !dbg !26 ; line:13 col:17 |
| 60 | + %5 = call %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32 1, %class.matrix.float.2.4* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0), %class.matrix.float.2.4 %4) #0, !dbg !26 ; line:13 col:17 |
| 61 | + %6 = load float, float* getelementptr inbounds ([1 x float], [1 x float]* @g.1.0.0, i32 0, i32 0), !dbg !32 ; line:17 col:9 |
| 62 | + %7 = getelementptr inbounds %class.matrix.float.2.4, %class.matrix.float.2.4* %h.0.1, i32 0, i32 0, i32 0, !dbg !32 ; line:17 col:9 |
| 63 | + %8 = load <4 x float>, <4 x float>* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0, i32 0, i32 0), !dbg !32 ; line:17 col:9 |
| 64 | + store <4 x float> %8, <4 x float>* %7, !dbg !32 ; line:17 col:9 |
| 65 | + %9 = getelementptr inbounds %class.matrix.float.2.4, %class.matrix.float.2.4* %h.0.1, i32 0, i32 0, i32 1, !dbg !32 ; line:17 col:9 |
| 66 | + %10 = load <4 x float>, <4 x float>* getelementptr inbounds ([1 x %class.matrix.float.2.4], [1 x %class.matrix.float.2.4]* @g.1.0.1, i32 0, i32 0, i32 0, i32 1), !dbg !32 ; line:17 col:9 |
| 67 | + store <4 x float> %10, <4 x float>* %9, !dbg !32 ; line:17 col:9 |
| 68 | + ret void, !dbg !33 ; line:18 col:3 |
| 69 | +} |
| 70 | + |
| 71 | +; Function Attrs: nounwind |
| 72 | +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0 |
| 73 | + |
| 74 | +; Function Attrs: nounwind readnone |
| 75 | +declare %class.matrix.float.2.4 @"dx.hl.init.rn.%class.matrix.float.2.4 (i32, <8 x float>)"(i32, <8 x float>) #1 |
| 76 | + |
| 77 | +; Function Attrs: nounwind readnone |
| 78 | +declare %class.matrix.float.2.4 @"dx.hl.cast.rowMatToColMat.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4)"(i32, %class.matrix.float.2.4) #1 |
| 79 | + |
| 80 | +; Function Attrs: nounwind |
| 81 | +declare %class.matrix.float.2.4 @"dx.hl.matldst.colStore.%class.matrix.float.2.4 (i32, %class.matrix.float.2.4*, %class.matrix.float.2.4)"(i32, %class.matrix.float.2.4*, %class.matrix.float.2.4) #0 |
| 82 | + |
| 83 | +attributes #0 = { nounwind } |
| 84 | +attributes #1 = { nounwind readnone } |
| 85 | + |
| 86 | +!llvm.module.flags = !{!0} |
| 87 | +!pauseresume = !{!1} |
| 88 | +!llvm.ident = !{!2} |
| 89 | +!dx.version = !{!3} |
| 90 | +!dx.valver = !{!4} |
| 91 | +!dx.shaderModel = !{!5} |
| 92 | +!dx.typeAnnotations = !{!6, !15} |
| 93 | +!dx.entryPoints = !{!19} |
| 94 | +!dx.fnprops = !{!23} |
| 95 | +!dx.options = !{!24, !25} |
| 96 | + |
| 97 | +!0 = !{i32 2, !"Debug Info Version", i32 3} |
| 98 | +!1 = !{!"hlsl-hlemit", !"hlsl-hlensure"} |
| 99 | +!2 = !{!"dxc(private) 1.8.0.4640 (issue-785, 45018c752d)"} |
| 100 | +!3 = !{i32 1, i32 0} |
| 101 | +!4 = !{i32 1, i32 8} |
| 102 | +!5 = !{!"cs", i32 6, i32 0} |
| 103 | +!6 = !{i32 0, %struct.e undef, !7, %struct.d undef, !10, %struct.a undef, !11} |
| 104 | +!7 = !{i32 152, !8, !9} |
| 105 | +!8 = !{i32 6, !"c", i32 3, i32 0} |
| 106 | +!9 = !{i32 6, !"f", i32 3, i32 80} |
| 107 | +!10 = !{i32 72, !8} |
| 108 | +!11 = !{i32 72, !12, !13} |
| 109 | +!12 = !{i32 6, !"b", i32 3, i32 0, i32 7, i32 9} |
| 110 | +!13 = !{i32 6, !"c", i32 2, !14, i32 3, i32 16, i32 7, i32 9} |
| 111 | +!14 = !{i32 2, i32 4, i32 2} |
| 112 | +!15 = !{i32 1, void ()* @main, !16} |
| 113 | +!16 = !{!17} |
| 114 | +!17 = !{i32 1, !18, !18} |
| 115 | +!18 = !{} |
| 116 | +!19 = !{void ()* @main, !"main", null, !20, null} |
| 117 | +!20 = !{null, null, !21, null} |
| 118 | +!21 = !{!22} |
| 119 | +!22 = !{i32 0, %ConstantBuffer* @"$Globals", !"$Globals", i32 0, i32 -1, i32 1, i32 0, null} |
| 120 | +!23 = !{void ()* @main, i32 5, i32 1, i32 1, i32 1} |
| 121 | +!24 = !{i32 64} |
| 122 | +!25 = !{i32 -1} |
| 123 | +!26 = !DILocation(line: 13, column: 17, scope: !27, inlinedAt: !30) |
| 124 | +!27 = !DISubprogram(name: "??__Eg@@YAXXZ", scope: !28, file: !28, line: 13, type: !29, isLocal: true, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: false) |
| 125 | +!28 = !DIFile(filename: "a.hlsl", directory: "") |
| 126 | +!29 = !DISubroutineType(types: !18) |
| 127 | +!30 = distinct !DILocation(line: 16, scope: !31) |
| 128 | +!31 = !DISubprogram(name: "main", scope: !28, file: !28, line: 16, type: !29, isLocal: false, isDefinition: true, scopeLine: 16, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @main) |
| 129 | +!32 = !DILocation(line: 17, column: 9, scope: !31) |
| 130 | +!33 = !DILocation(line: 18, column: 3, scope: !31) |
0 commit comments