diff options
| author | Yong He <yonghe@outlook.com> | 2020-07-23 13:47:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-23 13:47:12 -0700 |
| commit | fed4292a581364b611a82a0f6c1c1c95f82dfeb2 (patch) | |
| tree | f4e50a0d448f2710313a05b5def07a1c0a3b67b3 /source/slang/slang-ir-lower-generics.cpp | |
| parent | e93d3a443934b50fb983f77306a72e9c695bd5b9 (diff) | |
Run SSA pass to clean up temporary variables during generics lowering. (#1447)
* Run SSA pass to clean up generic temporary variables during lowering.
* Fix `undefined` emitting logic.
* revert dumpir control flag
* Defer fold decision of `undefined` values after special case logic for GLSL and HLSL.
* Update expected test result.
* Manually update raygen.slang.glsl to minimize change.
* fix formatting
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-ir-lower-generics.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-generics.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-ir-lower-generics.cpp b/source/slang/slang-ir-lower-generics.cpp index 61fa8ad17..c60b5386a 100644 --- a/source/slang/slang-ir-lower-generics.cpp +++ b/source/slang/slang-ir-lower-generics.cpp @@ -6,6 +6,8 @@ #include "slang-ir-lower-generic-call.h" #include "slang-ir-lower-generic-var.h" #include "slang-ir-witness-table-wrapper.h" +#include "slang-ir-ssa.h" +#include "slang-ir-dce.h" namespace Slang { @@ -16,7 +18,14 @@ namespace Slang sharedContext.module = module; lowerGenericFunctions(&sharedContext); lowerGenericCalls(&sharedContext); + // We might have generated new temporary variables during lowering. + // An SSA pass can clean up unncessary load/stores. + constructSSA(module); + eliminateDeadCode(module); lowerGenericVar(&sharedContext); + // After lowerGenericVar, there could be some unused `undef` values. + // We eliminate them in a DCE pass. + eliminateDeadCode(module); generateWitnessTableWrapperFunctions(&sharedContext); } } // namespace Slang |
