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-util.cpp | |
| parent | 57af2c1c2fccb221fa54fd92415f424b1d7e5beb (diff) | |
Add Loop Unrolling Pass. (#2644)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
| -rw-r--r-- | source/slang/slang-ir-util.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index 942c8f2f8..0448eb649 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -443,6 +443,27 @@ bool canInstHaveSideEffectAtAddress(IRGlobalValueWithCode* func, IRInst* inst, I return false; } +IRInst* getUndefInst(IRBuilder builder, IRModule* module) +{ + IRInst* undefInst = nullptr; + + for (auto inst : module->getModuleInst()->getChildren()) + { + if (inst->getOp() == kIROp_undefined && inst->getDataType() && inst->getDataType()->getOp() == kIROp_VoidType) + { + undefInst = inst; + break; + } + } + if (!undefInst) + { + auto voidType = builder.getVoidType(); + builder.setInsertAfter(voidType); + undefInst = builder.emitUndefined(voidType); + } + return undefInst; +} + bool isPureFunctionalCall(IRCall* call) { auto callee = getResolvedInstForDecorations(call->getCallee()); |
