From 957a4d3eb0a14a9d57bbb325ef0e1d458df2d2b9 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 21 Apr 2023 14:28:57 -0700 Subject: Refactor checkpointing policy and availability pass. (#2826) Co-authored-by: Yong He --- source/slang/slang-ir-util.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/slang/slang-ir-util.cpp') 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(param) || as(param)) + { + param->insertAtEnd(dest); + } + else + { + break; + } + param = nextInst; + } +} + struct GenericChildrenMigrationContextImpl { IRCloneEnv cloneEnv; -- cgit v1.2.3