summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-13 10:38:14 -0800
committerGitHub <noreply@github.com>2023-02-13 10:38:14 -0800
commit4dbc74a953ae1b34ce64a4eaef3aa7feb73663b9 (patch)
tree82b099c1074a0361b0db6a72e96f71d3b8e3b574 /source/slang/slang-emit.cpp
parent57af2c1c2fccb221fa54fd92415f424b1d7e5beb (diff)
Add Loop Unrolling Pass. (#2644)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 2ef0a5647..c49265fe7 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -34,6 +34,7 @@
#include "slang-ir-lower-optional-type.h"
#include "slang-ir-lower-bit-cast.h"
#include "slang-ir-lower-reinterpret.h"
+#include "slang-ir-loop-unroll.h"
#include "slang-ir-metadata.h"
#include "slang-ir-optix-entry-point-uniforms.h"
#include "slang-ir-restructure.h"
@@ -377,6 +378,16 @@ Result linkAndOptimizeIR(
// since we may be missing out cases prevented by the functions that we just specialzied.
performMandatoryEarlyInlining(irModule);
+ // Unroll loops.
+ if (codeGenContext->getSink()->getErrorCount() == 0)
+ {
+ SharedIRBuilder sharedBuilder(irModule);
+ sharedBuilder.deduplicateAndRebuildGlobalNumberingMap();
+ if (!unrollLoopsInModule(&sharedBuilder, irModule, codeGenContext->getSink()))
+ return SLANG_FAIL;
+ }
+
+
dumpIRIfEnabled(codeGenContext, irModule, "BEFORE-AUTODIFF");
enableIRValidationAtInsert();
changed |= processAutodiffCalls(irModule, sink);