SPIR-V: Return undefined values from implicit returns instead of dummy
Previously if a non-void function implictly returned, a dummy variable was created as return value. Now instead it returns the result of the OpUndef instruction. This better conveys the presence of undefined behavior to SPIR-V consuming tools (and humans). It also saves one ID per occurrence...
This commit is contained in:
30
Test/baseResults/spv.forwardFun.frag.out
Executable file → Normal file
30
Test/baseResults/spv.forwardFun.frag.out
Executable file → Normal file
@@ -5,7 +5,7 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 59
|
||||
// Id's are bound by 58
|
||||
|
||||
Source ESSL 100
|
||||
Capability Shader
|
||||
@@ -24,8 +24,7 @@ Linked fragment stage:
|
||||
Name 28 "f"
|
||||
Name 31 "gl_FragColor"
|
||||
Name 37 "d"
|
||||
Name 49 "dummyReturn"
|
||||
Name 58 "bigColor"
|
||||
Name 57 "bigColor"
|
||||
Decorate 19(color) RelaxedPrecision
|
||||
Decorate 21(BaseColor) RelaxedPrecision
|
||||
Decorate 21(BaseColor) Smooth
|
||||
@@ -33,8 +32,8 @@ Linked fragment stage:
|
||||
Decorate 31(gl_FragColor) RelaxedPrecision
|
||||
Decorate 31(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 37(d) RelaxedPrecision
|
||||
Decorate 58(bigColor) RelaxedPrecision
|
||||
Decorate 58(bigColor) NoStaticUse
|
||||
Decorate 57(bigColor) RelaxedPrecision
|
||||
Decorate 57(bigColor) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
9: TypeFloat 32
|
||||
@@ -53,8 +52,8 @@ Linked fragment stage:
|
||||
40: TypeBool
|
||||
44: 9(float) Constant 1067030938
|
||||
47: 9(float) Constant 1083179008
|
||||
57: TypePointer UniformConstant 13(fvec4)
|
||||
58(bigColor): 57(ptr) Variable UniformConstant
|
||||
56: TypePointer UniformConstant 13(fvec4)
|
||||
57(bigColor): 56(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
19(color): 14(ptr) Variable Function
|
||||
@@ -82,7 +81,6 @@ Linked fragment stage:
|
||||
FunctionEnd
|
||||
11(unreachableReturn(): 9(float) Function None 10
|
||||
12: Label
|
||||
49(dummyReturn): 27(ptr) Variable Function
|
||||
35: 2 FunctionCall 7(bar()
|
||||
38: 9(float) Load 37(d)
|
||||
41: 40(bool) FOrdLessThan 38 39
|
||||
@@ -93,16 +91,16 @@ Linked fragment stage:
|
||||
46: Label
|
||||
ReturnValue 47
|
||||
43: Label
|
||||
50: 9(float) Load 49(dummyReturn)
|
||||
ReturnValue 50
|
||||
49: 9(float) Undef
|
||||
ReturnValue 49
|
||||
FunctionEnd
|
||||
17(foo(vf4;): 9(float) Function None 15
|
||||
16(bar): 14(ptr) FunctionParameter
|
||||
18: Label
|
||||
51: 13(fvec4) Load 16(bar)
|
||||
52: 9(float) CompositeExtract 51 0
|
||||
53: 13(fvec4) Load 16(bar)
|
||||
54: 9(float) CompositeExtract 53 1
|
||||
55: 9(float) FAdd 52 54
|
||||
ReturnValue 55
|
||||
50: 13(fvec4) Load 16(bar)
|
||||
51: 9(float) CompositeExtract 50 0
|
||||
52: 13(fvec4) Load 16(bar)
|
||||
53: 9(float) CompositeExtract 52 1
|
||||
54: 9(float) FAdd 51 53
|
||||
ReturnValue 54
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user