summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-redundancy-removal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-redundancy-removal.cpp')
-rw-r--r--source/slang/slang-ir-redundancy-removal.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/slang/slang-ir-redundancy-removal.cpp b/source/slang/slang-ir-redundancy-removal.cpp
index c7986cfbc..b679d8438 100644
--- a/source/slang/slang-ir-redundancy-removal.cpp
+++ b/source/slang/slang-ir-redundancy-removal.cpp
@@ -25,9 +25,9 @@ struct RedundancyRemovalContext
for (UInt i = 0; i < inst->getOperandCount(); i++)
{
auto operand = inst->getOperand(i);
- if (getParentFunc(operand) != func)
+ if (!hasDescendent(func, operand))
{
- // Global value won't prevent hoisting.
+ // Only prevent hoisting from operands local to this function
continue;
}
auto operandParent = as<IRBlock>(operand->getParent());