diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-19 13:50:49 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-19 13:50:49 -0700 |
| commit | 1cfb1c85b52e00cde2d21874a88cda2c22d18b62 (patch) | |
| tree | a38b24534d865ffe33a3d0fc030f5449ba729e28 /source/slang/slang-lower-to-ir.cpp | |
| parent | 1fe5e83f3dcc8ef0efa2dd083ebdfab5d0f101a9 (diff) | |
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 <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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<Derived, LoweredValInfo> else if (auto declRefType = as<DeclRefType>(type)) { DeclRef<Decl> declRef = declRefType->declRef; - if (auto aggTypeDeclRef = declRef.as<AggTypeDecl>()) + if (auto enumType = declRef.as<EnumDecl>()) + { + return LoweredValInfo::simple(getBuilder()->getIntValue(irType, 0)); + } + else if (auto aggTypeDeclRef = declRef.as<AggTypeDecl>()) { List<IRInst*> args; @@ -9854,7 +9858,11 @@ RefPtr<IRModule> generateIRForTranslationUnit( constructSSA(module); simplifyCFG(module); applySparseConditionalConstantPropagation(module, compileRequest->getSink()); - + for (auto inst : module->getGlobalInsts()) + { + if (auto func = as<IRGlobalValueWithCode>(inst)) + eliminateDeadCode(func); + } // Next, inline calls to any functions that have been // marked for mandatory "early" inlining. // |
