diff options
Diffstat (limited to 'source/slang/slang-ir-specialize-function-call.cpp')
| -rw-r--r-- | source/slang/slang-ir-specialize-function-call.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang-ir-specialize-function-call.cpp b/source/slang/slang-ir-specialize-function-call.cpp index 9b7cdaea6..bc238e6ec 100644 --- a/source/slang/slang-ir-specialize-function-call.cpp +++ b/source/slang/slang-ir-specialize-function-call.cpp @@ -31,6 +31,9 @@ bool FunctionCallSpecializeCondition::isParamSuitableForSpecialization(IRParam* // if (as<IRGlobalParam>(arg)) return true; + // Similarly for these global values + if( as<IRGlobalValueWithCode>(arg) ) return true; + // As we will see later, we can also // specialize a call when the argument // is the result of indexing into an @@ -505,6 +508,11 @@ struct FunctionParameterSpecializationContext // ioInfo.key.vals.add(oldGlobalParam); } + else if( auto globalConstant = as<IRGlobalValueWithCode>(oldArg) ) + { + // Similarly for other global constants + ioInfo.key.vals.add(globalConstant); + } else if( oldArg->getOp() == kIROp_GetElement ) { // This is the case where the `oldArg` is @@ -626,6 +634,12 @@ struct FunctionParameterSpecializationContext // return globalParam; } + if( auto globalFunc = as<IRGlobalValueWithCode>(oldArg) ) + { + // As above, the identity of the specialized function is sufficient + // to resolve the uses + return globalFunc; + } else if( oldArg->getOp() == kIROp_GetElement ) { // This is the case where the argument is |
