Remapper: remove debug info for IDs stripped in other passes

If some DCE is performed such as removing dead functions, then even
if we are NOT stripping debug info, we still must remove the debug
opcodes that refer to the now-dead IDs.

Also, this adds a small change to perform no ID remapping if none
is requested, making spirv-remap properly be a no-op if no options
are given.
This commit is contained in:
steve-lunarg 2016-12-09 11:13:23 -07:00
parent 906cc21816
commit 297754cfe8
11 changed files with 246 additions and 219 deletions

View file

@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 82
// Id's are bound by 86
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 50 69 71
EntryPoint Fragment 4 "main" 53 73 75
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
@ -18,13 +18,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Name 13 "bound"
Name 17 "r"
Name 19 "x"
Name 42 "param"
Name 50 "ini4"
Name 69 "outf4"
Name 71 "inf"
Name 74 "param"
Name 44 "param"
Name 53 "ini4"
Name 73 "outf4"
Name 75 "inf"
Name 78 "param"
Decorate 50(ini4) Flat
Name 82 "param"
Decorate 53(ini4) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@ -37,35 +37,35 @@ Warning, version 450 is not yet complete; most version-specific features are pre
28: TypeBool
30: 8(float) Constant 1056964608
34: 6(int) Constant 1
38: 6(int) Constant 2
48: TypeVector 6(int) 4
49: TypePointer Input 48(ivec4)
50(ini4): 49(ptr) Variable Input
51: TypeInt 32 0
52: 51(int) Constant 1
53: TypePointer Input 6(int)
56: 51(int) Constant 2
61: 51(int) Constant 0
67: TypeVector 8(float) 4
68: TypePointer Output 67(fvec4)
69(outf4): 68(ptr) Variable Output
70: TypePointer Input 8(float)
71(inf): 70(ptr) Variable Input
40: 6(int) Constant 2
51: TypeVector 6(int) 4
52: TypePointer Input 51(ivec4)
53(ini4): 52(ptr) Variable Input
54: TypeInt 32 0
55: 54(int) Constant 1
56: TypePointer Input 6(int)
59: 54(int) Constant 2
64: 54(int) Constant 0
71: TypeVector 8(float) 4
72: TypePointer Output 71(fvec4)
73(outf4): 72(ptr) Variable Output
74: TypePointer Input 8(float)
75(inf): 74(ptr) Variable Input
4(main): 2 Function None 3
5: Label
74(param): 7(ptr) Variable Function
78(param): 7(ptr) Variable Function
72: 8(float) Load 71(inf)
73: 6(int) ConvertFToS 72
Store 74(param) 73
75: 8(float) FunctionCall 11(Test1(i1;) 74(param)
76: 8(float) Load 71(inf)
82(param): 7(ptr) Variable Function
76: 8(float) Load 75(inf)
77: 6(int) ConvertFToS 76
Store 78(param) 77
79: 8(float) FunctionCall 14(Test2(i1;) 78(param)
80: 8(float) FAdd 75 79
81: 67(fvec4) CompositeConstruct 80 80 80 80
Store 69(outf4) 81
79: 8(float) FunctionCall 11(Test1(i1;) 78(param)
80: 8(float) Load 75(inf)
81: 6(int) ConvertFToS 80
Store 82(param) 81
83: 8(float) FunctionCall 14(Test2(i1;) 82(param)
84: 8(float) FAdd 79 83
85: 71(fvec4) CompositeConstruct 84 84 84 84
Store 73(outf4) 85
Return
FunctionEnd
11(Test1(i1;): 8(float) Function None 9
@ -101,31 +101,31 @@ Warning, version 450 is not yet complete; most version-specific features are pre
14(Test2(i1;): 8(float) Function None 9
13(bound): 7(ptr) FunctionParameter
15: Label
42(param): 7(ptr) Variable Function
37: 6(int) Load 13(bound)
39: 28(bool) SGreaterThan 37 38
SelectionMerge 41 None
BranchConditional 39 40 45
40: Label
43: 6(int) Load 13(bound)
Store 42(param) 43
44: 8(float) FunctionCall 11(Test1(i1;) 42(param)
ReturnValue 44
45: Label
46: 6(int) Load 13(bound)
47: 6(int) IMul 46 38
54: 53(ptr) AccessChain 50(ini4) 52
55: 6(int) Load 54
57: 53(ptr) AccessChain 50(ini4) 56
44(param): 7(ptr) Variable Function
39: 6(int) Load 13(bound)
41: 28(bool) SGreaterThan 39 40
SelectionMerge 43 None
BranchConditional 41 42 48
42: Label
45: 6(int) Load 13(bound)
Store 44(param) 45
46: 8(float) FunctionCall 11(Test1(i1;) 44(param)
ReturnValue 46
48: Label
49: 6(int) Load 13(bound)
50: 6(int) IMul 49 40
57: 56(ptr) AccessChain 53(ini4) 55
58: 6(int) Load 57
59: 6(int) IMul 55 58
60: 6(int) IAdd 47 59
62: 53(ptr) AccessChain 50(ini4) 61
63: 6(int) Load 62
64: 6(int) IAdd 60 63
65: 8(float) ConvertSToF 64
ReturnValue 65
41: Label
66: 8(float) Undef
ReturnValue 66
60: 56(ptr) AccessChain 53(ini4) 59
61: 6(int) Load 60
62: 6(int) IMul 58 61
63: 6(int) IAdd 50 62
65: 56(ptr) AccessChain 53(ini4) 64
66: 6(int) Load 65
67: 6(int) IAdd 63 66
68: 8(float) ConvertSToF 67
ReturnValue 68
43: Label
70: 8(float) Undef
ReturnValue 70
FunctionEnd