diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2023-02-27 23:42:06 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-27 23:42:06 -0500 |
| commit | 10e2d9c7c532c204f26bb2c9f383f21b121b2ff2 (patch) | |
| tree | 9ae0dd84b505a7ecd3fb45de9dbde74f8dd1ebe9 /source/slang/slang-ir-loop-unroll.cpp | |
| parent | a3ba22b51c371d5a20d61aa4e35233ba4f4f68db (diff) | |
More fixes for reverse-mode on complicated loops (#2675)
* Multiple fixes to get various loop tests to pass.
* Create reverse-nested-loop.slang
* Fix for variables becoming inaccessible during cfg normalization
* Removed comments and moved break-branch-normalization to eliminateMultiLevelBreaks
* Fix.
* Override liveness tests
Diffstat (limited to 'source/slang/slang-ir-loop-unroll.cpp')
| -rw-r--r-- | source/slang/slang-ir-loop-unroll.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir-loop-unroll.cpp b/source/slang/slang-ir-loop-unroll.cpp index 2f689ebde..4f9b8d272 100644 --- a/source/slang/slang-ir-loop-unroll.cpp +++ b/source/slang/slang-ir-loop-unroll.cpp @@ -603,6 +603,16 @@ void eliminateContinueBlocks(IRModule* module, IRLoop* loopInst) builder.setInsertInto(innerBreakableRegionBreakBlock); _moveParams(innerBreakableRegionBreakBlock, continueBlock); builder.emitBranch(continueBlock); + + // If the original loop can be executed up to N times, the new loop may be executed + // upto N+1 times (although most insts are skipped in the last traversal) + // + if (auto maxItersDecoration = loopInst->findDecoration<IRLoopMaxItersDecoration>()) + { + auto maxIters = maxItersDecoration->getMaxIters(); + maxItersDecoration->removeAndDeallocate(); + builder.addLoopMaxItersDecoration(loopInst, maxIters + 1); + } } void eliminateContinueBlocksInFunc(IRModule* module, IRGlobalValueWithCode* func) |
