summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-dce.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-24 19:44:23 -0700
committerGitHub <noreply@github.com>2023-04-24 19:44:23 -0700
commit284cee1f246c072f190c87c8fb60c1d2181e458f (patch)
tree6f8b4ff3d619ad518e733000464daae233890962 /source/slang/slang-ir-dce.cpp
parentfbe37ea6d90f7bfe18506b042657c6e533eaf9b2 (diff)
Change AD checkpointing policy to recompute more. (#2836)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-dce.cpp')
-rw-r--r--source/slang/slang-ir-dce.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/source/slang/slang-ir-dce.cpp b/source/slang/slang-ir-dce.cpp
index 364abe68c..1b0ecf521 100644
--- a/source/slang/slang-ir-dce.cpp
+++ b/source/slang/slang-ir-dce.cpp
@@ -223,25 +223,6 @@ struct DeadCodeEliminationContext
return processInst(module->getModuleInst());
}
- void removePhiArgs(IRInst* phiParam)
- {
- auto block = cast<IRBlock>(phiParam->getParent());
- UInt paramIndex = 0;
- for (auto p = block->getFirstParam(); p; p = p->getNextParam())
- {
- if (p == phiParam)
- break;
- paramIndex++;
- }
- for (auto predBlock : block->getPredecessors())
- {
- auto termInst = as<IRUnconditionalBranch>(predBlock->getTerminator());
- SLANG_ASSERT(paramIndex < termInst->getArgCount());
- termInst->removeArgument(paramIndex);
- }
- phiRemoved = true;
- }
-
bool eliminateDeadInstsRec(IRInst* inst)
{
bool changed = false;
@@ -266,6 +247,7 @@ struct DeadCodeEliminationContext
{
// For Phi parameters, we need to update all branch arguments.
removePhiArgs(inst);
+ phiRemoved = true;
}
inst->removeAndDeallocate();
changed = true;