diff options
Diffstat (limited to 'source/slang/slang-ir-ssa-simplification.cpp')
| -rw-r--r-- | source/slang/slang-ir-ssa-simplification.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/slang-ir-ssa-simplification.cpp b/source/slang/slang-ir-ssa-simplification.cpp index f06fafcb3..beaaae065 100644 --- a/source/slang/slang-ir-ssa-simplification.cpp +++ b/source/slang/slang-ir-ssa-simplification.cpp @@ -10,6 +10,7 @@ #include "slang-ir-deduplicate-generic-children.h" #include "slang-ir-remove-unused-generic-param.h" #include "slang-ir-redundancy-removal.h" +#include "slang-ir-propagate-func-properties.h" namespace Slang { @@ -29,6 +30,7 @@ namespace Slang changed |= peepholeOptimize(module); changed |= removeRedundancy(module); changed |= simplifyCFG(module); + changed |= propagateFuncProperties(module); // Note: we disregard the `changed` state from dead code elimination pass since // SCCP pass could be generating temporarily evaluated constant values and never actually use them. @@ -41,6 +43,28 @@ namespace Slang } } + void simplifyNonSSAIR(IRModule* module) + { + bool changed = true; + const int kMaxIterations = 8; + int iterationCounter = 0; + while (changed && iterationCounter < kMaxIterations) + { + changed = false; + changed |= peepholeOptimize(module); + changed |= removeRedundancy(module); + changed |= simplifyCFG(module); + + // Note: we disregard the `changed` state from dead code elimination pass since + // SCCP pass could be generating temporarily evaluated constant values and never actually use them. + // DCE will always remove those nearly generated consts and always returns true here. + eliminateDeadCode(module); + + iterationCounter++; + } + } + + void simplifyFunc(IRGlobalValueWithCode* func) { bool changed = true; |
