Don't remove SPIR-V blocks before codegen.

A removed block releases its instructions, so Module::idToInstruction
suddenly contains dangling references.  The original motivation for
block removal was to skip some unreachable blocks, but that's already
achieved by InReadableOrder.cpp.

Also updated stale comments.
This commit is contained in:
Dejan Mircevski
2016-01-19 21:13:38 -05:00
parent 33782795d9
commit ed55bcd9f8
17 changed files with 1233 additions and 1252 deletions

View File

@@ -5,12 +5,12 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 93
// Id's are bound by 96
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 69 73 92
EntryPoint Vertex 4 "main" 72 76 95
Source GLSL 130
Name 4 "main"
Name 14 "xf(mf33;vf3;"
@@ -21,18 +21,18 @@ Linked vertex stage:
Name 26 "mxv(mf44;vf3;"
Name 24 "m4"
Name 25 "v"
Name 63 "param"
Name 69 "gl_Position"
Name 71 "m4"
Name 73 "v3"
Name 74 "param"
Name 76 "param"
Name 80 "m3"
Name 81 "param"
Name 83 "param"
Name 92 "gl_VertexID"
Decorate 69(gl_Position) BuiltIn Position
Decorate 92(gl_VertexID) BuiltIn VertexId
Name 65 "param"
Name 72 "gl_Position"
Name 74 "m4"
Name 76 "v3"
Name 77 "param"
Name 79 "param"
Name 83 "m3"
Name 84 "param"
Name 86 "param"
Name 95 "gl_VertexID"
Decorate 72(gl_Position) BuiltIn Position
Decorate 95(gl_VertexID) BuiltIn VertexId
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -46,45 +46,45 @@ Linked vertex stage:
18: TypePointer Function 17
19: TypeFunction 8 18(ptr)
23: TypeFunction 7(fvec3) 18(ptr) 10(ptr)
32: TypeInt 32 1
33: 32(int) Constant 0
34: TypePointer Function 16(fvec4)
38: 32(int) Constant 1
42: 32(int) Constant 2
46: 6(float) Constant 1065353216
47: 6(float) Constant 0
68: TypePointer Output 16(fvec4)
69(gl_Position): 68(ptr) Variable Output
70: TypePointer UniformConstant 17
71(m4): 70(ptr) Variable UniformConstant
72: TypePointer Input 7(fvec3)
73(v3): 72(ptr) Variable Input
79: TypePointer UniformConstant 8
80(m3): 79(ptr) Variable UniformConstant
91: TypePointer Input 32(int)
92(gl_VertexID): 91(ptr) Variable Input
33: TypeInt 32 1
34: 33(int) Constant 0
35: TypePointer Function 16(fvec4)
39: 33(int) Constant 1
43: 33(int) Constant 2
47: 6(float) Constant 1065353216
48: 6(float) Constant 0
71: TypePointer Output 16(fvec4)
72(gl_Position): 71(ptr) Variable Output
73: TypePointer UniformConstant 17
74(m4): 73(ptr) Variable UniformConstant
75: TypePointer Input 7(fvec3)
76(v3): 75(ptr) Variable Input
82: TypePointer UniformConstant 8
83(m3): 82(ptr) Variable UniformConstant
94: TypePointer Input 33(int)
95(gl_VertexID): 94(ptr) Variable Input
4(main): 2 Function None 3
5: Label
74(param): 18(ptr) Variable Function
76(param): 10(ptr) Variable Function
81(param): 9(ptr) Variable Function
83(param): 10(ptr) Variable Function
75: 17 Load 71(m4)
Store 74(param) 75
77: 7(fvec3) Load 73(v3)
Store 76(param) 77
78: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 74(param) 76(param)
82: 8 Load 80(m3)
Store 81(param) 82
84: 7(fvec3) Load 73(v3)
Store 83(param) 84
85: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 81(param) 83(param)
86: 7(fvec3) FAdd 78 85
87: 6(float) CompositeExtract 86 0
88: 6(float) CompositeExtract 86 1
89: 6(float) CompositeExtract 86 2
90: 16(fvec4) CompositeConstruct 87 88 89 46
Store 69(gl_Position) 90
77(param): 18(ptr) Variable Function
79(param): 10(ptr) Variable Function
84(param): 9(ptr) Variable Function
86(param): 10(ptr) Variable Function
78: 17 Load 74(m4)
Store 77(param) 78
80: 7(fvec3) Load 76(v3)
Store 79(param) 80
81: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 77(param) 79(param)
85: 8 Load 83(m3)
Store 84(param) 85
87: 7(fvec3) Load 76(v3)
Store 86(param) 87
88: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 84(param) 86(param)
89: 7(fvec3) FAdd 81 88
90: 6(float) CompositeExtract 89 0
91: 6(float) CompositeExtract 89 1
92: 6(float) CompositeExtract 89 2
93: 16(fvec4) CompositeConstruct 90 91 92 47
Store 72(gl_Position) 93
Return
FunctionEnd
14(xf(mf33;vf3;): 7(fvec3) Function None 11
@@ -99,39 +99,39 @@ Linked vertex stage:
21(Mat3(mf44;): 8 Function None 19
20(m): 18(ptr) FunctionParameter
22: Label
35: 34(ptr) AccessChain 20(m) 33
36: 16(fvec4) Load 35
37: 7(fvec3) VectorShuffle 36 36 0 1 2
39: 34(ptr) AccessChain 20(m) 38
40: 16(fvec4) Load 39
41: 7(fvec3) VectorShuffle 40 40 0 1 2
43: 34(ptr) AccessChain 20(m) 42
44: 16(fvec4) Load 43
45: 7(fvec3) VectorShuffle 44 44 0 1 2
48: 6(float) CompositeExtract 37 0
49: 6(float) CompositeExtract 37 1
50: 6(float) CompositeExtract 37 2
51: 6(float) CompositeExtract 41 0
52: 6(float) CompositeExtract 41 1
53: 6(float) CompositeExtract 41 2
54: 6(float) CompositeExtract 45 0
55: 6(float) CompositeExtract 45 1
56: 6(float) CompositeExtract 45 2
57: 7(fvec3) CompositeConstruct 48 49 50
58: 7(fvec3) CompositeConstruct 51 52 53
59: 7(fvec3) CompositeConstruct 54 55 56
60: 8 CompositeConstruct 57 58 59
ReturnValue 60
36: 35(ptr) AccessChain 20(m) 34
37: 16(fvec4) Load 36
38: 7(fvec3) VectorShuffle 37 37 0 1 2
40: 35(ptr) AccessChain 20(m) 39
41: 16(fvec4) Load 40
42: 7(fvec3) VectorShuffle 41 41 0 1 2
44: 35(ptr) AccessChain 20(m) 43
45: 16(fvec4) Load 44
46: 7(fvec3) VectorShuffle 45 45 0 1 2
49: 6(float) CompositeExtract 38 0
50: 6(float) CompositeExtract 38 1
51: 6(float) CompositeExtract 38 2
52: 6(float) CompositeExtract 42 0
53: 6(float) CompositeExtract 42 1
54: 6(float) CompositeExtract 42 2
55: 6(float) CompositeExtract 46 0
56: 6(float) CompositeExtract 46 1
57: 6(float) CompositeExtract 46 2
58: 7(fvec3) CompositeConstruct 49 50 51
59: 7(fvec3) CompositeConstruct 52 53 54
60: 7(fvec3) CompositeConstruct 55 56 57
61: 8 CompositeConstruct 58 59 60
ReturnValue 61
FunctionEnd
26(mxv(mf44;vf3;): 7(fvec3) Function None 23
24(m4): 18(ptr) FunctionParameter
25(v): 10(ptr) FunctionParameter
27: Label
63(param): 18(ptr) Variable Function
62: 7(fvec3) Load 25(v)
64: 17 Load 24(m4)
Store 63(param) 64
65: 8 FunctionCall 21(Mat3(mf44;) 63(param)
66: 7(fvec3) VectorTimesMatrix 62 65
ReturnValue 66
65(param): 18(ptr) Variable Function
64: 7(fvec3) Load 25(v)
66: 17 Load 24(m4)
Store 65(param) 66
67: 8 FunctionCall 21(Mat3(mf44;) 65(param)
68: 7(fvec3) VectorTimesMatrix 64 67
ReturnValue 68
FunctionEnd