summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
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);