summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 9378a69e8..383067363 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -9102,9 +9102,24 @@ RefPtr<IRModule> generateIRForTranslationUnit(
// normal `call` + `ifElse`, etc.
lowerErrorHandling(module, compileRequest->getSink());
+ // Next, attempt to promote local variables to SSA
+ // temporaries and do basic simplifications.
+ //
+ constructSSA(module);
+ simplifyCFG(module);
+ applySparseConditionalConstantPropagation(module);
+
// Next, inline calls to any functions that have been
// marked for mandatory "early" inlining.
//
+ // Note: We performed certain critical simplifications
+ // above, before this step, so that the body of functions
+ // subject to mandatory inlining can be simplified ahead
+ // of time. By simplifying the body before inlining it,
+ // we can make sure that things like superfluous temporaries
+ // are eliminated from the callee, and not copied into
+ // call sites.
+ //
performMandatoryEarlyInlining(module);
// Next, attempt to promote local variables to SSA