1+ // RUN: %dxc /T vs_6_0 /Zi /O1 %s | FileCheck %s
2+ // RUN: %dxc /T vs_6_0 /Zi /O2 %s | FileCheck %s
3+ // RUN: %dxc /T vs_6_0 /Zi /O3 %s | FileCheck %s
4+
5+ // CHECK: @main
6+ // CHECK: @call @llvm.dbg.declare
7+
8+ // Regression test for #4536
9+ // HL Matrix lowering recreated dbg.declare calls but didn't copy over the
10+ // debug location, which led to assert in code that expected all dbg insts
11+ // to have debug location.
12+
13+ static const float StaticConst1 = 0 ;
14+ static const float StaticConst2 = 0 ;
15+ static const float StaticConst3 = 0 ;
16+ static const float StaticConst4 = 0 ;
17+ static const float StaticConst5 = 0 ;
18+ static const float StaticConst6 = 0 ;
19+ static const float StaticConst7 = 0 ;
20+ static const float StaticConst8 = 0 ;
21+ static const float StaticConst9 = 0 ;
22+ static const float StaticConst10 = 0 ;
23+ static const float StaticConst11 = 0 ;
24+ static const float StaticConst12 = 0 ;
25+ static const float StaticConst13 = 0 ;
26+ static const float StaticConst14 = 0 ;
27+ static const float StaticConst15 = 0 ;
28+ static const float StaticConst16 = 0 ;
29+ static const float StaticConst17 = 0 ;
30+ static const float StaticConst18 = 0 ;
31+ static const float StaticConst19 = 0 ;
32+ static const float StaticConst20 = 0 ;
33+ static const float StaticConst21 = 0 ;
34+ static const float StaticConst22 = 0 ;
35+ static const float StaticConst23 = 0 ;
36+ static const float StaticConst24 = 0 ;
37+ static const float StaticConst25 = 0 ;
38+ static const float StaticConst26 = 0 ;
39+ static const float StaticConst27 = 0 ;
40+ static const float StaticConst28 = 0 ;
41+ static const float StaticConst29 = 0 ;
42+ static const float StaticConst30 = 0 ;
43+ static const float StaticConst31 = 0 ;
44+ static const float StaticConst32 = 0 ;
45+ static const float StaticConst33 = 0 ;
46+ static const float StaticConst34 = 0 ;
47+ static const float StaticConst35 = 0 ;
48+ static const float StaticConst36 = 0 ;
49+ static const float StaticConst37 = 0 ;
50+ static const float StaticConst38 = 0 ;
51+ static const float StaticConst39 = 0 ;
52+
53+ // Removing any of the above "fixes" the problem, but so does uncommenting these!
54+ //static const float StaticConst40 = 0;
55+ //static const float StaticConst41 = 0;
56+ //static const float StaticConst42 = 0;
57+ //static const float StaticConst43 = 0;
58+ //static const float StaticConst44 = 0;
59+ //static const float StaticConst45 = 0;
60+
61+ StructuredBuffer<float > Buf;
62+
63+ float calculateSomething (float a, float b, float c, float d)
64+ {
65+ return 0 ;
66+ }
67+
68+ float4x4 createMatrix (StructuredBuffer<float > buffer, float otherParam)
69+ {
70+ float v1 = calculateSomething (0 , 0 , 0 , 0 );
71+ float v2 = calculateSomething (0 , 0 , 0 , 0 );
72+ float v3 = 0 ;
73+ float v4 = 0 ;
74+ float v5 = 0 ;
75+ float v6 = 0 ;
76+ float v7 = 0 ;
77+ float v8 = 0 ;
78+ float v9 = 0 ;
79+ float v10 = 0 ;
80+ // Removing any of the above "fixes" the problem, but so does uncommenting these!
81+ //float v11 = 0;
82+ //float v12 = 0;
83+ //float v13 = 0;
84+ return 0 ;
85+ }
86+
87+ float4x4 getMatrix ()
88+ {
89+ return createMatrix (Buf, 0 );
90+ }
91+
92+ void doNothing (float param) { }
93+
94+ struct NestedStruct1
95+ {
96+ float4x4 matrixMember;
97+
98+ void init ()
99+ {
100+ getMatrix ();
101+ matrixMember = getMatrix ();
102+ }
103+ };
104+
105+ struct NestedStruct2
106+ {
107+ NestedStruct1 nested1;
108+ float2x2 otherMember;
109+ void setNested1 (NestedStruct1 val) { nested1 = val; }
110+ };
111+
112+ struct NestedStruct3
113+ {
114+ NestedStruct2 nested2;
115+ void setNested2 (NestedStruct2 val) { nested2 = val; }
116+ };
117+
118+ struct NestedStruct4
119+ {
120+ NestedStruct3 nested3;
121+ void setNested3 (NestedStruct3 val) { nested3 = val; }
122+ };
123+
124+ void main (
125+ float In0 : TEXCOORD0 ,
126+ float In1 : TEXCOORD1 ,
127+ float In2 : TEXCOORD2 ,
128+ float In3 : TEXCOORD3 ,
129+ out float4 Position : SV_Position )
130+ {
131+ NestedStruct4 s4;
132+ NestedStruct3 s3;
133+ NestedStruct2 s2;
134+ NestedStruct1 s1;
135+
136+ doNothing (0 );
137+ doNothing (0 );
138+ doNothing (0 );
139+ doNothing (0 );
140+ doNothing (0 );
141+ doNothing (0 );
142+ doNothing (0 );
143+
144+ s1.init ();
145+ s2.setNested1 (s1);
146+ s3.setNested2 (s2);
147+ s4.setNested3 (s3);
148+
149+ Position = 0 ;
150+ }
0 commit comments