From 1cfb1c85b52e00cde2d21874a88cda2c22d18b62 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 19 Jul 2023 13:50:49 -0700 Subject: Optimize specialization, and remove unnecessary calls to `simplifyIR`. (#2999) * Remove unneccessary calls to `simplifyIR`. * fix. * Delete obsolete hoistConst pass. * Fix. * Small improvements. * Fix. * Fix enum lowering. * fix * tweaks. * tweaks. --------- Co-authored-by: Yong He --- source/slang/slang-lower-to-ir.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-lower-to-ir.cpp') diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 0dcea9a14..63dc39a20 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -3674,7 +3674,11 @@ struct ExprLoweringVisitorBase : ExprVisitor else if (auto declRefType = as(type)) { DeclRef declRef = declRefType->declRef; - if (auto aggTypeDeclRef = declRef.as()) + if (auto enumType = declRef.as()) + { + return LoweredValInfo::simple(getBuilder()->getIntValue(irType, 0)); + } + else if (auto aggTypeDeclRef = declRef.as()) { List args; @@ -9854,7 +9858,11 @@ RefPtr generateIRForTranslationUnit( constructSSA(module); simplifyCFG(module); applySparseConditionalConstantPropagation(module, compileRequest->getSink()); - + for (auto inst : module->getGlobalInsts()) + { + if (auto func = as(inst)) + eliminateDeadCode(func); + } // Next, inline calls to any functions that have been // marked for mandatory "early" inlining. // -- cgit v1.2.3