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

@ -7,34 +7,34 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 103
// Id's are bound by 104
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 38 43 77
EntryPoint Fragment 4 "main" 39 44 78
ExecutionMode 4 OriginLowerLeft
Source GLSL 430
Name 4 "main"
Name 17 "foo(f1[5][7];"
Name 16 "a"
Name 20 "r"
Name 38 "outfloat"
Name 41 "g4"
Name 43 "g5"
Name 44 "param"
Name 47 "u"
Name 51 "param"
Name 65 "many"
Name 67 "i"
Name 69 "j"
Name 71 "k"
Name 77 "infloat"
Name 93 "uAofA"
MemberName 93(uAofA) 0 "f"
Name 97 "nameAofA"
Decorate 93(uAofA) GLSLShared
Decorate 93(uAofA) Block
Name 39 "outfloat"
Name 42 "g4"
Name 44 "g5"
Name 45 "param"
Name 48 "u"
Name 52 "param"
Name 66 "many"
Name 68 "i"
Name 70 "j"
Name 72 "k"
Name 78 "infloat"
Name 94 "uAofA"
MemberName 94(uAofA) 0 "f"
Name 98 "nameAofA"
Decorate 94(uAofA) GLSLShared
Decorate 94(uAofA) Block
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -53,82 +53,82 @@ Linked fragment stage:
25: 21(int) Constant 0
28: 21(int) Constant 1
32: 21(int) Constant 3
37: TypePointer Output 6(float)
38(outfloat): 37(ptr) Variable Output
39: 6(float) Constant 0
40: TypePointer Private 14
41(g4): 40(ptr) Variable Private
42: TypePointer Input 11
43(g5): 42(ptr) Variable Input
48: 6(float) Constant 1077936128
49: TypePointer Function 6(float)
54: 7(int) Constant 6
55: TypeArray 6(float) 54
56: TypeArray 55 10
57: TypeArray 56 13
58: 7(int) Constant 3
59: TypeArray 57 58
60: 7(int) Constant 2
61: TypeArray 59 60
62: 7(int) Constant 1
63: TypeArray 61 62
64: TypePointer Private 63
65(many): 64(ptr) Variable Private
66: TypePointer UniformConstant 21(int)
67(i): 66(ptr) Variable UniformConstant
69(j): 66(ptr) Variable UniformConstant
71(k): 66(ptr) Variable UniformConstant
76: TypePointer Input 6(float)
77(infloat): 76(ptr) Variable Input
79: TypePointer Private 6(float)
91: TypeArray 6(float) 13
92: TypeArray 91 60
93(uAofA): TypeStruct 92
94: TypeArray 93(uAofA) 10
95: TypeArray 94 58
96: TypePointer Uniform 95
97(nameAofA): 96(ptr) Variable Uniform
98: TypePointer Uniform 6(float)
38: TypePointer Output 6(float)
39(outfloat): 38(ptr) Variable Output
40: 6(float) Constant 0
41: TypePointer Private 14
42(g4): 41(ptr) Variable Private
43: TypePointer Input 11
44(g5): 43(ptr) Variable Input
49: 6(float) Constant 1077936128
50: TypePointer Function 6(float)
55: 7(int) Constant 6
56: TypeArray 6(float) 55
57: TypeArray 56 10
58: TypeArray 57 13
59: 7(int) Constant 3
60: TypeArray 58 59
61: 7(int) Constant 2
62: TypeArray 60 61
63: 7(int) Constant 1
64: TypeArray 62 63
65: TypePointer Private 64
66(many): 65(ptr) Variable Private
67: TypePointer UniformConstant 21(int)
68(i): 67(ptr) Variable UniformConstant
70(j): 67(ptr) Variable UniformConstant
72(k): 67(ptr) Variable UniformConstant
77: TypePointer Input 6(float)
78(infloat): 77(ptr) Variable Input
80: TypePointer Private 6(float)
92: TypeArray 6(float) 13
93: TypeArray 92 61
94(uAofA): TypeStruct 93
95: TypeArray 94(uAofA) 10
96: TypeArray 95 59
97: TypePointer Uniform 96
98(nameAofA): 97(ptr) Variable Uniform
99: TypePointer Uniform 6(float)
4(main): 2 Function None 3
5: Label
44(param): 12(ptr) Variable Function
47(u): 12(ptr) Variable Function
51(param): 12(ptr) Variable Function
Store 38(outfloat) 39
45: 11 Load 43(g5)
Store 44(param) 45
46: 14 FunctionCall 17(foo(f1[5][7];) 44(param)
Store 41(g4) 46
50: 49(ptr) AccessChain 47(u) 22 22
Store 50 48
52: 11 Load 47(u)
Store 51(param) 52
53: 14 FunctionCall 17(foo(f1[5][7];) 51(param)
68: 21(int) Load 67(i)
70: 21(int) Load 69(j)
72: 21(int) Load 71(k)
73: 21(int) Load 67(i)
74: 21(int) Load 69(j)
75: 21(int) Load 71(k)
78: 6(float) Load 77(infloat)
80: 79(ptr) AccessChain 65(many) 68 70 72 73 74 75
Store 80 78
81: 21(int) Load 69(j)
82: 21(int) Load 69(j)
83: 21(int) Load 69(j)
84: 21(int) Load 69(j)
85: 21(int) Load 69(j)
86: 21(int) Load 69(j)
87: 79(ptr) AccessChain 65(many) 81 82 83 84 85 86
88: 6(float) Load 87
89: 6(float) Load 38(outfloat)
90: 6(float) FAdd 89 88
Store 38(outfloat) 90
99: 98(ptr) AccessChain 97(nameAofA) 28 22 25 25 32
100: 6(float) Load 99
101: 6(float) Load 38(outfloat)
102: 6(float) FAdd 101 100
Store 38(outfloat) 102
45(param): 12(ptr) Variable Function
48(u): 12(ptr) Variable Function
52(param): 12(ptr) Variable Function
Store 39(outfloat) 40
46: 11 Load 44(g5)
Store 45(param) 46
47: 14 FunctionCall 17(foo(f1[5][7];) 45(param)
Store 42(g4) 47
51: 50(ptr) AccessChain 48(u) 22 22
Store 51 49
53: 11 Load 48(u)
Store 52(param) 53
54: 14 FunctionCall 17(foo(f1[5][7];) 52(param)
69: 21(int) Load 68(i)
71: 21(int) Load 70(j)
73: 21(int) Load 72(k)
74: 21(int) Load 68(i)
75: 21(int) Load 70(j)
76: 21(int) Load 72(k)
79: 6(float) Load 78(infloat)
81: 80(ptr) AccessChain 66(many) 69 71 73 74 75 76
Store 81 79
82: 21(int) Load 70(j)
83: 21(int) Load 70(j)
84: 21(int) Load 70(j)
85: 21(int) Load 70(j)
86: 21(int) Load 70(j)
87: 21(int) Load 70(j)
88: 80(ptr) AccessChain 66(many) 82 83 84 85 86 87
89: 6(float) Load 88
90: 6(float) Load 39(outfloat)
91: 6(float) FAdd 90 89
Store 39(outfloat) 91
100: 99(ptr) AccessChain 98(nameAofA) 28 22 25 25 32
101: 6(float) Load 100
102: 6(float) Load 39(outfloat)
103: 6(float) FAdd 102 101
Store 39(outfloat) 103
Return
FunctionEnd
17(foo(f1[5][7];): 14 Function None 15