From dd57306d951dbcaf6471659fcd1d2c37738f36d0 Mon Sep 17 00:00:00 2001 From: Pankaj Mistry <63069047+pmistryNV@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:55:19 -0800 Subject: IRSPIRVAsmOperandInst instructions may not have IRBlock as the immediate parent. Previously special case was added to handle IRDecoration similarly. Replace this with a common method getBlock that traverses the parent chain till it gets to the Block (#3486) Fixes bug #3432 --- source/slang/slang-ir-validate.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/slang/slang-ir-validate.cpp') diff --git a/source/slang/slang-ir-validate.cpp b/source/slang/slang-ir-validate.cpp index af793bb54..5caa8a66e 100644 --- a/source/slang/slang-ir-validate.cpp +++ b/source/slang/slang-ir-validate.cpp @@ -4,6 +4,7 @@ #include "slang-ir.h" #include "slang-ir-insts.h" #include "slang-ir-dominators.h" +#include "slang-ir-util.h" namespace Slang { @@ -144,13 +145,7 @@ namespace Slang auto operandParent = operandValue->getParent(); - auto instParentBlock = as(instParent); - if (!instParentBlock && as(inst)) - { - instParent = instParent->getParent(); - instParentBlock = as(instParent); - } - + auto instParentBlock = getBlock(inst); if (instParentBlock) { if (auto operandParentBlock = as(operandParent)) -- cgit v1.2.3