summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-21 14:28:57 -0700
committerGitHub <noreply@github.com>2023-04-21 14:28:57 -0700
commit957a4d3eb0a14a9d57bbb325ef0e1d458df2d2b9 (patch)
treefabc9317b1595c9f74f5b25ee83d16f4260a19d3 /source/slang/slang-ir-util.cpp
parent69a327a98e3f9504863f9ecb623aa93036ac43db (diff)
Refactor checkpointing policy and availability pass. (#2826)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 83f6735bd..03b74b36a 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -681,6 +681,9 @@ bool isPureFunctionalCall(IRCall* call)
// are not dependent on whatever we do in the call here.
continue;
default:
+ // Skip the call itself, since we are checking if the call has side effect.
+ if (use->getUser() == call)
+ continue;
// We have some other unknown use of the variable address, they can
// be loads, or calls using addresses derived from the variable,
// we will treat the call as having side effect to be safe.
@@ -721,6 +724,23 @@ IRInst* findWitnessTableEntry(IRWitnessTable* table, IRInst* key)
return nullptr;
}
+void moveParams(IRBlock* dest, IRBlock* src)
+{
+ for (auto param = src->getFirstChild(); param;)
+ {
+ auto nextInst = param->getNextInst();
+ if (as<IRDecoration>(param) || as<IRParam>(param))
+ {
+ param->insertAtEnd(dest);
+ }
+ else
+ {
+ break;
+ }
+ param = nextInst;
+ }
+}
+
struct GenericChildrenMigrationContextImpl
{
IRCloneEnv cloneEnv;