summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-04-02 12:34:58 -0500
committerGitHub <noreply@github.com>2025-04-02 10:34:58 -0700
commitc1f69ca1e29811919dbd2f08a6e2dd498b80aab2 (patch)
tree7e41262b8bd04ebd38d388cf84ba45553db44d4d /source/slang/slang-emit.cpp
parente44479c88806a711f6d5f821a4acff030f9a558b (diff)
Metal remove void field (#6725)
* Reapply "Eliminate empty struct on metal target (#6603)" (#6711) This reverts commit bc9dc6557fc0cc3a4c0c2ff27e636940e361cf5d. * Remove argument in make_struct call corresponding to void field This is a follow-up of #6543, where we leave the VoidType field as it in make_struct call during legalization pass. So during cleaning_void IR pass, when we remove "VoidType" from struct, we will have to also clean up the argument corresponding to the "VoidType" field.
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 841f44a80..8d7577b52 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -1278,6 +1278,15 @@ Result linkAndOptimizeIR(
//
legalizeResourceTypes(targetProgram, irModule, sink);
+ // We also need to legalize empty types for Metal targets.
+ switch (target)
+ {
+ case CodeGenTarget::Metal:
+ case CodeGenTarget::MetalLib:
+ case CodeGenTarget::MetalLibAssembly:
+ legalizeEmptyTypes(targetProgram, irModule, sink);
+ break;
+ }
// Debugging output of legalization
#if 0
dumpIRIfEnabled(codeGenContext, irModule, "LEGALIZED");