Sanitize debug source location tracking for implicit branch and return
This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
This commit is contained in:
parent
b1fac200c4
commit
a496a34b43
30 changed files with 4713 additions and 4253 deletions
325
Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out
Normal file
325
Test/baseResults/spv.debuginfo.implicit_br.glsl.frag.out
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
spv.debuginfo.implicit_br.glsl.frag
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 194
|
||||
|
||||
Capability Shader
|
||||
Extension "SPV_KHR_non_semantic_info"
|
||||
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
|
||||
3: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 14 "main" 186
|
||||
ExecutionMode 14 OriginUpperLeft
|
||||
2: String "spv.debuginfo.implicit_br.glsl.frag"
|
||||
8: String "uint"
|
||||
18: String "test_if"
|
||||
21: String "// OpModuleProcessed auto-map-locations
|
||||
// OpModuleProcessed auto-map-bindings
|
||||
// OpModuleProcessed client vulkan100
|
||||
// OpModuleProcessed target-env vulkan1.0
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
#version 460
|
||||
|
||||
out int outx;
|
||||
int counter = 0;
|
||||
|
||||
void test_if() {
|
||||
if (false) {
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void test_ifelse() {
|
||||
if (false) {
|
||||
counter += 1;
|
||||
}
|
||||
else {
|
||||
counter += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void test_if_compound() {
|
||||
if (false) {
|
||||
if (false) {
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test_if_compound2() {
|
||||
if (false) {
|
||||
if (false) {
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
counter += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void test_switch() {
|
||||
switch (0) {
|
||||
case 0:
|
||||
counter += 1;
|
||||
// implict fallthrough
|
||||
case 1:
|
||||
counter += 2;
|
||||
break;
|
||||
default:
|
||||
counter += 3;
|
||||
// implicit break
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
test_if();
|
||||
test_ifelse();
|
||||
test_if_compound();
|
||||
test_if_compound2();
|
||||
test_switch();
|
||||
outx = counter;
|
||||
}"
|
||||
28: String "test_ifelse"
|
||||
33: String "test_if_compound"
|
||||
38: String "test_if_compound2"
|
||||
43: String "test_switch"
|
||||
46: String "main"
|
||||
50: String "int"
|
||||
56: String "counter"
|
||||
65: String "bool"
|
||||
188: String "outx"
|
||||
Name 14 "main"
|
||||
Name 16 "test_if("
|
||||
Name 26 "test_ifelse("
|
||||
Name 31 "test_if_compound("
|
||||
Name 36 "test_if_compound2("
|
||||
Name 41 "test_switch("
|
||||
Name 54 "counter"
|
||||
Name 186 "outx"
|
||||
Decorate 186(outx) Location 0
|
||||
4: TypeVoid
|
||||
5: TypeFunction 4
|
||||
7: TypeInt 32 0
|
||||
10: 7(int) Constant 32
|
||||
11: 7(int) Constant 6
|
||||
12: 7(int) Constant 0
|
||||
9: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 8 10 11 12
|
||||
13: 7(int) Constant 3
|
||||
6: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(DebugTypeFunction) 13 4
|
||||
20: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(DebugSource) 2 21
|
||||
23: 7(int) Constant 1
|
||||
24: 7(int) Constant 4
|
||||
25: 7(int) Constant 2
|
||||
22: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(DebugCompilationUnit) 23 24 20 25
|
||||
19: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 18 6 20 11 12 22 18 13 11
|
||||
30: 7(int) Constant 12
|
||||
29: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 28 6 20 30 12 22 28 13 30
|
||||
35: 7(int) Constant 21
|
||||
34: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 33 6 20 35 12 22 33 13 35
|
||||
40: 7(int) Constant 29
|
||||
39: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 38 6 20 40 12 22 38 13 40
|
||||
45: 7(int) Constant 39
|
||||
44: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 43 6 20 45 12 22 43 13 45
|
||||
48: 7(int) Constant 53
|
||||
47: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(DebugFunction) 46 6 20 48 12 22 46 13 48
|
||||
49: TypeInt 32 1
|
||||
51: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 50 10 24 12
|
||||
52: TypePointer Private 49(int)
|
||||
53: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 11 12
|
||||
54(counter): 52(ptr) Variable Private
|
||||
57: 7(int) Constant 8
|
||||
55: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 56 51 20 24 12 22 56 54(counter) 57
|
||||
58: 49(int) Constant 0
|
||||
64: TypeBool
|
||||
66: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 65 10 25 12
|
||||
67: 64(bool) ConstantFalse
|
||||
70: 49(int) Constant 1
|
||||
77: 7(int) Constant 10
|
||||
86: 7(int) Constant 14
|
||||
89: 49(int) Constant 2
|
||||
93: 7(int) Constant 17
|
||||
97: 7(int) Constant 19
|
||||
110: 7(int) Constant 24
|
||||
114: 7(int) Constant 27
|
||||
131: 7(int) Constant 35
|
||||
135: 7(int) Constant 37
|
||||
146: 7(int) Constant 42
|
||||
151: 7(int) Constant 45
|
||||
154: 7(int) Constant 46
|
||||
156: 49(int) Constant 3
|
||||
160: 7(int) Constant 48
|
||||
165: 7(int) Constant 51
|
||||
171: 7(int) Constant 54
|
||||
174: 7(int) Constant 55
|
||||
177: 7(int) Constant 56
|
||||
180: 7(int) Constant 57
|
||||
183: 7(int) Constant 58
|
||||
184: TypePointer Output 49(int)
|
||||
185: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 51 13 12
|
||||
186(outx): 184(ptr) Variable Output
|
||||
189: 7(int) Constant 59
|
||||
187: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 188 51 20 189 12 22 188 186(outx) 57
|
||||
193: 7(int) Constant 60
|
||||
14(main): 4 Function None 5
|
||||
15: Label
|
||||
59: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 22
|
||||
60: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 24 24 12 12
|
||||
Store 54(counter) 58
|
||||
167: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 47
|
||||
168: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 48 48 12 12
|
||||
166: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 47 14(main)
|
||||
170: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 171 171 12 12
|
||||
169: 4 FunctionCall 16(test_if()
|
||||
173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 174 174 12 12
|
||||
172: 4 FunctionCall 26(test_ifelse()
|
||||
176: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 177 177 12 12
|
||||
175: 4 FunctionCall 31(test_if_compound()
|
||||
179: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 180 180 12 12
|
||||
178: 4 FunctionCall 36(test_if_compound2()
|
||||
182: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 183 183 12 12
|
||||
181: 4 FunctionCall 41(test_switch()
|
||||
191: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 189 189 12 12
|
||||
190: 49(int) Load 54(counter)
|
||||
Store 186(outx) 190
|
||||
192: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 193 193 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
16(test_if(): 4 Function None 5
|
||||
17: Label
|
||||
62: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19
|
||||
63: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 11 11 12 12
|
||||
61: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 19 16(test_if()
|
||||
SelectionMerge 69 None
|
||||
BranchConditional 67 68 69
|
||||
68: Label
|
||||
72: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19
|
||||
73: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 57 57 12 12
|
||||
71: 49(int) Load 54(counter)
|
||||
74: 49(int) IAdd 71 70
|
||||
Store 54(counter) 74
|
||||
Branch 69
|
||||
69: Label
|
||||
75: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 19
|
||||
76: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 77 77 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
26(test_ifelse(): 4 Function None 5
|
||||
27: Label
|
||||
79: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29
|
||||
80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 30 30 12 12
|
||||
78: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 29 26(test_ifelse()
|
||||
SelectionMerge 82 None
|
||||
BranchConditional 67 81 88
|
||||
81: Label
|
||||
84: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29
|
||||
85: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 86 86 12 12
|
||||
83: 49(int) Load 54(counter)
|
||||
87: 49(int) IAdd 83 70
|
||||
Store 54(counter) 87
|
||||
Branch 82
|
||||
88: Label
|
||||
91: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29
|
||||
92: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 93 93 12 12
|
||||
90: 49(int) Load 54(counter)
|
||||
94: 49(int) IAdd 90 89
|
||||
Store 54(counter) 94
|
||||
Branch 82
|
||||
82: Label
|
||||
95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 29
|
||||
96: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 97 97 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
31(test_if_compound(): 4 Function None 5
|
||||
32: Label
|
||||
99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34
|
||||
100: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12
|
||||
98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 34 31(test_if_compound()
|
||||
SelectionMerge 102 None
|
||||
BranchConditional 67 101 102
|
||||
101: Label
|
||||
105: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34
|
||||
106: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 35 35 12 12
|
||||
SelectionMerge 104 None
|
||||
BranchConditional 67 103 104
|
||||
103: Label
|
||||
108: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34
|
||||
109: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 110 110 12 12
|
||||
107: 49(int) Load 54(counter)
|
||||
111: 49(int) IAdd 107 70
|
||||
Store 54(counter) 111
|
||||
Branch 104
|
||||
104: Label
|
||||
Branch 102
|
||||
102: Label
|
||||
112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 34
|
||||
113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 114 114 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
36(test_if_compound2(): 4 Function None 5
|
||||
37: Label
|
||||
116: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39
|
||||
117: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12
|
||||
115: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 39 36(test_if_compound2()
|
||||
SelectionMerge 119 None
|
||||
BranchConditional 67 118 119
|
||||
118: Label
|
||||
122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39
|
||||
123: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 40 40 12 12
|
||||
SelectionMerge 121 None
|
||||
BranchConditional 67 120 121
|
||||
120: Label
|
||||
125: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39
|
||||
126: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 10 10 12 12
|
||||
124: 49(int) Load 54(counter)
|
||||
127: 49(int) IAdd 124 70
|
||||
Store 54(counter) 127
|
||||
Branch 121
|
||||
121: Label
|
||||
129: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39
|
||||
130: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 131 131 12 12
|
||||
128: 49(int) Load 54(counter)
|
||||
132: 49(int) IAdd 128 89
|
||||
Store 54(counter) 132
|
||||
Branch 119
|
||||
119: Label
|
||||
133: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 39
|
||||
134: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 135 135 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
41(test_switch(): 4 Function None 5
|
||||
42: Label
|
||||
137: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
|
||||
138: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 45 45 12 12
|
||||
136: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 44 41(test_switch()
|
||||
SelectionMerge 142 None
|
||||
Switch 58 141
|
||||
case 0: 139
|
||||
case 1: 140
|
||||
141: Label
|
||||
158: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
|
||||
159: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 160 160 12 12
|
||||
157: 49(int) Load 54(counter)
|
||||
161: 49(int) IAdd 157 156
|
||||
Store 54(counter) 161
|
||||
Branch 142
|
||||
139: Label
|
||||
144: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
|
||||
145: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 146 146 12 12
|
||||
143: 49(int) Load 54(counter)
|
||||
147: 49(int) IAdd 143 70
|
||||
Store 54(counter) 147
|
||||
Branch 140
|
||||
140: Label
|
||||
149: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
|
||||
150: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 151 151 12 12
|
||||
148: 49(int) Load 54(counter)
|
||||
152: 49(int) IAdd 148 89
|
||||
Store 54(counter) 152
|
||||
153: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 154 154 12 12
|
||||
Branch 142
|
||||
142: Label
|
||||
163: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 44
|
||||
164: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 20 165 165 12 12
|
||||
Return
|
||||
FunctionEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue