summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-ir-specialize.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir-specialize.cpp b/source/slang/slang-ir-specialize.cpp
index 05c28d131..d2e042363 100644
--- a/source/slang/slang-ir-specialize.cpp
+++ b/source/slang/slang-ir-specialize.cpp
@@ -2439,6 +2439,16 @@ IRInst* specializeGenericImpl(
// value.
cloneInstDecorationsAndChildren(
&env, module, specializeInst, specializedVal);
+
+ // Perform IR simplifications to fold constants in this specialized value if it is a function, so
+ // further specializations from the specialized function will have as simple specialization
+ // arguments as possible to avoid creating specializations that eventually simplified into
+ // the same thing.
+ if (auto func = as<IRFunc>(specializedVal))
+ {
+ simplifyFunc(func);
+ }
+
return specializedVal;
}