summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-22 14:17:56 -0700
committerGitHub <noreply@github.com>2022-08-22 14:17:56 -0700
commit4bd3e6e02324f913e8927fe69d32c0aafe9fc831 (patch)
tree1f6ff8449feb49d00dee2bc527f7dc531a07c196 /source/slang/slang-emit.cpp
parent393185196ed65a9eeaf9502edbf3dcce87337d81 (diff)
Make Optional<PointerType> lower to PointerType instead of a struct. (#2373)
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 3ec03d0e7..11e0812d9 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -212,22 +212,6 @@ Result linkAndOptimizeIR(
// un-specialized IR.
dumpIRIfEnabled(codeGenContext, irModule);
- switch (target)
- {
- case CodeGenTarget::CPPSource:
- case CodeGenTarget::HostCPPSource:
- {
- lowerComInterfaces(irModule, artifactDesc.style, sink);
- generateDllImportFuncs(codeGenContext->getTargetReq(), irModule, sink);
- generateDllExportFuncs(irModule, sink);
- break;
- }
- default: break;
- }
-
- // Lower `Result<T,E>` types into ordinary struct types.
- lowerResultType(irModule, sink);
-
// Replace any global constants with their values.
//
replaceGlobalConstants(irModule);
@@ -323,6 +307,24 @@ Result linkAndOptimizeIR(
break;
}
+ lowerOptionalType(irModule, sink);
+ simplifyIR(irModule);
+
+ switch (target)
+ {
+ case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
+ {
+ lowerComInterfaces(irModule, artifactDesc.style, sink);
+ generateDllImportFuncs(codeGenContext->getTargetReq(), irModule, sink);
+ generateDllExportFuncs(irModule, sink);
+ break;
+ }
+ default: break;
+ }
+
+ // Lower `Result<T,E>` types into ordinary struct types.
+ lowerResultType(irModule, sink);
// Desguar any union types, since these will be illegal on
// various targets.
@@ -393,8 +395,6 @@ Result linkAndOptimizeIR(
//
simplifyIR(irModule);
- lowerOptionalType(irModule, sink);
-
#if 0
dumpIRIfEnabled(codeGenContext, irModule, "AFTER DCE");
#endif