summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-specialize-function-call.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-02-25 20:49:31 -0800
committerGitHub <noreply@github.com>2022-02-25 20:49:31 -0800
commitc31577953d5041c82375c22d847c2eba06106c58 (patch)
treebc685a8b63fc13cb85d160ae13df950056ca6e91 /source/slang/slang-ir-specialize-function-call.cpp
parent8990d270e3a0c01b1f7abbf4f79556c5ef82a096 (diff)
Improved SCCP, inlining and resource specialization passes, legalize `ImageSubscript` for GLSL (#2146)
Diffstat (limited to 'source/slang/slang-ir-specialize-function-call.cpp')
-rw-r--r--source/slang/slang-ir-specialize-function-call.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/slang/slang-ir-specialize-function-call.cpp b/source/slang/slang-ir-specialize-function-call.cpp
index ab77ec88e..1e63be890 100644
--- a/source/slang/slang-ir-specialize-function-call.cpp
+++ b/source/slang/slang-ir-specialize-function-call.cpp
@@ -100,7 +100,7 @@ struct FunctionParameterSpecializationContext
// With the basic state out of the way, let's walk
// through the overall flow of the pass.
//
- void processModule()
+ bool processModule()
{
// We will start by initializing our IR building state.
//
@@ -112,6 +112,8 @@ struct FunctionParameterSpecializationContext
//
addCallsToWorkListRec(module->getModuleInst());
+ bool changed = false;
+
// We will process the work list until it goes dry,
// treating it like a stack of work items.
//
@@ -130,8 +132,10 @@ struct FunctionParameterSpecializationContext
if( canSpecializeCall(call) )
{
specializeCall(call);
+ changed = true;
}
}
+ return changed;
}
// Setting up the work list is a simple recursive procedure.
@@ -353,6 +357,7 @@ struct FunctionParameterSpecializationContext
// we need to generate a call to it, and then use the new
// call as a replacement for the old one.
//
+ SLANG_ASSERT(newFunc != oldCall->getCallee());
auto newCall = getBuilder()->emitCallInst(
oldCall->getFullType(),
newFunc,
@@ -877,7 +882,7 @@ struct FunctionParameterSpecializationContext
// is straighforward. We set up the context object
// and then defer to it for the real work.
//
-void specializeFunctionCalls(
+bool specializeFunctionCalls(
BackEndCompileRequest* compileRequest,
TargetRequest* targetRequest,
IRModule* module,
@@ -889,7 +894,7 @@ void specializeFunctionCalls(
context.module = module;
context.condition = condition;
- context.processModule();
+ return context.processModule();
}
} // namesapce Slang