summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-link.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-08-18 21:57:24 -0700
committerGitHub <noreply@github.com>2024-08-18 21:57:24 -0700
commitecf85df6eee3da76ef54b14e4ab083f22da89e46 (patch)
tree4656f9c11a1f7f40550d469fecbcd7a16c541f52 /source/slang/slang-ir-link.cpp
parentca5d303748517889a5d5849224671fa8945e1c6d (diff)
Variadic Generics Part 2: IR lowering and specialization. (#4849)
* Variadic Generics Part 2: IR lowering and specialization. * Update design doc status. * Update design doc. * Resolve review comments.
Diffstat (limited to 'source/slang/slang-ir-link.cpp')
-rw-r--r--source/slang/slang-ir-link.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp
index 5bb485b22..8b08b9045 100644
--- a/source/slang/slang-ir-link.cpp
+++ b/source/slang/slang-ir-link.cpp
@@ -1170,6 +1170,17 @@ IRFunc* cloneFuncImpl(
return clonedFunc;
}
+// Can an inst with `opcode` contain basic blocks as children?
+bool canInstContainBasicBlocks(IROp opcode)
+{
+ switch (opcode)
+ {
+ case kIROp_Expand:
+ return true;
+ default:
+ return false;
+ }
+}
IRInst* cloneInst(
IRSpecContextBase* context,
@@ -1238,7 +1249,10 @@ IRInst* cloneInst(
argCount, newArgs.getArrayView().getBuffer());
builder->addInst(clonedInst);
registerClonedValue(context, clonedInst, originalValues);
- cloneDecorationsAndChildren(context, clonedInst, originalInst);
+ if (canInstContainBasicBlocks(clonedInst->getOp()))
+ cloneGlobalValueWithCodeCommon(context, (IRGlobalValueWithCode*)clonedInst, (IRGlobalValueWithCode*)originalInst, originalValues);
+ else
+ cloneDecorationsAndChildren(context, clonedInst, originalInst);
cloneExtraDecorations(context, clonedInst, originalValues);
return clonedInst;
}