summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-sccp.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-12-19 11:47:19 -0800
committerGitHub <noreply@github.com>2022-12-19 11:47:19 -0800
commit216dfba0af66210a46ef0df18beb73d975fdf727 (patch)
treef397ea5bf8d47d7a5d90dc95edfb472f2e49d762 /source/slang/slang-ir-sccp.cpp
parent36220da1e29c891972fef32c8575c15f868b9959 (diff)
Separate primal computations from unzipped function into an explicit function. (#2569)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-sccp.cpp')
-rw-r--r--source/slang/slang-ir-sccp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-ir-sccp.cpp b/source/slang/slang-ir-sccp.cpp
index fbc00848b..c03eee695 100644
--- a/source/slang/slang-ir-sccp.cpp
+++ b/source/slang/slang-ir-sccp.cpp
@@ -1678,5 +1678,21 @@ bool applySparseConditionalConstantPropagation(
return changed;
}
+
+bool applySparseConditionalConstantPropagation(IRInst* func)
+{
+ SharedSCCPContext shared;
+ shared.module = func->getModule();
+ shared.sharedBuilder.init(shared.module);
+ shared.sharedBuilder.deduplicateAndRebuildGlobalNumberingMap();
+
+ SCCPContext globalContext;
+ globalContext.shared = &shared;
+ globalContext.code = nullptr;
+
+ // Run recursive SCCP passes on each child code block.
+ return applySparseConditionalConstantPropagationRec(globalContext, func);
+}
+
}