From 61a6c211b1587a7b9ed6a24ae1ba6fe0600c80d8 Mon Sep 17 00:00:00 2001 From: jarcherNV Date: Fri, 11 Apr 2025 14:51:48 -0700 Subject: Add flag to hoist instructions (#6740) This fixes issue #6654 Only hoist instructions that are optimized by prepareFuncForForwardDiff. Add flag hoistLoopInvariantInsts to IRSimplificationOptions and set this to true only if called from prepareFuncForForwardDiff, then only hoist if the flag is set. Additionally, do not hoist loops if they only have a single trivial iteration. --- source/slang/slang-ir-defer-buffer-load.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/slang-ir-defer-buffer-load.cpp') diff --git a/source/slang/slang-ir-defer-buffer-load.cpp b/source/slang/slang-ir-defer-buffer-load.cpp index fea73e705..bd3b78f9e 100644 --- a/source/slang/slang-ir-defer-buffer-load.cpp +++ b/source/slang/slang-ir-defer-buffer-load.cpp @@ -167,7 +167,7 @@ struct DeferBufferLoadContext void deferBufferLoadInFunc(IRFunc* func) { - removeRedundancyInFunc(func); + removeRedundancyInFunc(func, false); currentFunc = func; dominatorTree = func->getModule()->findOrCreateDominatorTree(func); -- cgit v1.2.3