From 0bc89bc13251fedc9ed90cf473d2e6eb7fda3abf Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Sun, 2 Jun 2024 10:27:13 +0800 Subject: Prevent hoisting of non-hoistable instructions in non-function values with code (#4250) --- source/slang/slang-ir-redundancy-removal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir-redundancy-removal.cpp') 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(operand->getParent()); -- cgit v1.2.3