summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-08-23 21:45:59 -0700
committerGitHub <noreply@github.com>2024-08-23 21:45:59 -0700
commitb2ca2d5a4efeae807d3c3f48f60235e47413b559 (patch)
tree643d2bab5776e5f8f7cfa722975af9e826d77c9d /source/slang/slang-ir.cpp
parente4088cd602bd4d5a72fea67a787b1319acfc044d (diff)
Make variadic generics work with interfaces and forward autodiff. (#4905)
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index e0769686c..0b0a42617 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4114,12 +4114,17 @@ namespace Slang
// `getTupleElement(makeTuple(a_0, a_1, ... a_N), i)` then we should
// just return `a_i`, provided that the index is properly in range.
//
- if( auto makeTuple = as<IRMakeTuple>(tuple) )
+ switch(tuple->getOp())
{
- if( element < makeTuple->getOperandCount() )
+ case kIROp_MakeTuple:
+ case kIROp_MakeValuePack:
+ case kIROp_MakeWitnessPack:
+ case kIROp_TypePack:
+ if( element < tuple->getOperandCount() )
{
- return makeTuple->getOperand(element);
+ return tuple->getOperand(element);
}
+ break;
}
return emitGetTupleElement(type, tuple, getIntValue(getIntType(), element));
}
@@ -8345,6 +8350,7 @@ namespace Slang
case kIROp_DifferentialPairGetDifferential:
case kIROp_MakeDifferentialPair:
case kIROp_MakeTuple:
+ case kIROp_MakeValuePack:
case kIROp_GetTupleElement:
case kIROp_StructuredBufferLoad:
case kIROp_RWStructuredBufferLoad: