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