diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-13 10:38:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-13 10:38:14 -0800 |
| commit | 4dbc74a953ae1b34ce64a4eaef3aa7feb73663b9 (patch) | |
| tree | 82b099c1074a0361b0db6a72e96f71d3b8e3b574 /source/slang/slang-ir-dce.cpp | |
| parent | 57af2c1c2fccb221fa54fd92415f424b1d7e5beb (diff) | |
Add Loop Unrolling Pass. (#2644)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-dce.cpp')
| -rw-r--r-- | source/slang/slang-ir-dce.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/source/slang/slang-ir-dce.cpp b/source/slang/slang-ir-dce.cpp index 337caa246..05c10b317 100644 --- a/source/slang/slang-ir-dce.cpp +++ b/source/slang/slang-ir-dce.cpp @@ -86,21 +86,13 @@ struct DeadCodeEliminationContext { if (!undefInst) { - for (auto inst : module->getModuleInst()->getChildren()) - { - if (inst->getOp() == kIROp_undefined && inst->getDataType() && inst->getDataType()->getOp() == kIROp_VoidType) - { - undefInst = inst; - break; - } - } - if (!undefInst) - { - SharedIRBuilder builderStorage(module); - IRBuilder builder(&builderStorage); + SharedIRBuilder builderStorage(module); + IRBuilder builder(&builderStorage); + if (auto firstChild = module->getModuleInst()->getFirstChild()) + builder.setInsertBefore(firstChild); + else builder.setInsertInto(module->getModuleInst()); - undefInst = builder.emitUndefined(builder.getVoidType()); - } + undefInst = Slang::getUndefInst(builder, module); } return undefInst; } |
