summaryrefslogtreecommitdiff
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.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index a4362b912..20459c722 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -778,9 +778,6 @@ Result linkAndOptimizeIR(
break;
}
- if (requiredLoweringPassSet.optionalType)
- lowerOptionalType(irModule, sink);
-
switch (target)
{
case CodeGenTarget::CUDASource:
@@ -792,20 +789,6 @@ Result linkAndOptimizeIR(
break;
}
- switch (target)
- {
- case CodeGenTarget::CPPSource:
- case CodeGenTarget::HostCPPSource:
- {
- lowerComInterfaces(irModule, artifactDesc.style, sink);
- generateDllImportFuncs(codeGenContext->getTargetProgram(), irModule, sink);
- generateDllExportFuncs(irModule, sink);
- break;
- }
- default:
- break;
- }
-
#if 0
dumpIRIfEnabled(codeGenContext, irModule, "UNIONS DESUGARED");
#endif
@@ -947,12 +930,6 @@ Result linkAndOptimizeIR(
break;
}
- // Lower `Result<T,E>` types into ordinary struct types. This must happen
- // after specialization, since otherwise incompatible copies of the lowered
- // result structure are generated.
- if (requiredLoweringPassSet.resultType)
- lowerResultType(irModule, sink);
-
// Report checkpointing information
if (codeGenContext->shouldReportCheckpointIntermediates())
{
@@ -978,6 +955,29 @@ Result linkAndOptimizeIR(
finalizeSpecialization(irModule);
+ // Lower `Result<T,E>` types into ordinary struct types. This must happen
+ // after specialization, since otherwise incompatible copies of the lowered
+ // result structure are generated.
+ if (requiredLoweringPassSet.resultType)
+ lowerResultType(irModule, sink);
+
+ if (requiredLoweringPassSet.optionalType)
+ lowerOptionalType(irModule, sink);
+
+ switch (target)
+ {
+ case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
+ {
+ lowerComInterfaces(irModule, artifactDesc.style, sink);
+ generateDllImportFuncs(codeGenContext->getTargetProgram(), irModule, sink);
+ generateDllExportFuncs(irModule, sink);
+ break;
+ }
+ default:
+ break;
+ }
+
requiredLoweringPassSet = {};
calcRequiredLoweringPassSet(requiredLoweringPassSet, codeGenContext, irModule->getModuleInst());