summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-clone.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-clone.cpp')
-rw-r--r--source/slang/slang-ir-clone.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/slang-ir-clone.cpp b/source/slang/slang-ir-clone.cpp
index 9258e511f..43b60d6ed 100644
--- a/source/slang/slang-ir-clone.cpp
+++ b/source/slang/slang-ir-clone.cpp
@@ -267,7 +267,15 @@ IRInst* cloneInst(
env, builder, oldInst);
env->mapOldValToNew.add(oldInst, newInst);
-
+
+ // For hoistable insts, its possible that the cloned inst is the same
+ // as the original inst.
+ // Skip the decoration/children cloning in that case (which will end up
+ // in an infinite loop)
+ //
+ if (newInst == oldInst)
+ return newInst;
+
cloneInstDecorationsAndChildren(
env, builder->getModule(), oldInst, newInst);