From e22b4dbb1bed1393fc028b87b8ff6ff30e1b73f3 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 28 Mar 2023 11:12:40 -0700 Subject: Small fixes and cleanups on CUDA/CPP codegen. (#2746) * Small fixes and cleanups on CUDA/CPP codegen. * Disable `legalizeEmptyTypes` for now. --------- Co-authored-by: Yong He --- source/slang/slang-emit.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 6a0f46e0a..a18eed928 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -475,7 +475,6 @@ Result linkAndOptimizeIR( // We don't need the legalize pass for C/C++ based types if(options.shouldLegalizeExistentialAndResourceTypes ) -// if (!(sourceLanguage == SourceLanguage::CPP || sourceStyle == SourceLanguage::C)) { // The Slang language allows interfaces to be used like // ordinary types (including placing them in constant @@ -534,6 +533,20 @@ Result linkAndOptimizeIR( #endif validateIRModuleIfEnabled(codeGenContext, irModule); } + else + { +#if 0 + // On CPU/CUDA targets, we simply elminate any empty types. + // TODO: disable for now, since the CPU compute shader + // trampoline is still hard coded to assume there are + // entrypoint and global parameters. renable when + // we fix that logic. + legalizeEmptyTypes( + irModule, + sink); + eliminateDeadCode(irModule); +#endif + } // Once specialization and type legalization have been performed, // we should perform some of our basic optimization steps again, -- cgit v1.2.3