summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-lower-generic-type.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-03 15:54:16 -0700
committerGitHub <noreply@github.com>2023-04-03 15:54:16 -0700
commitb68516e2c2e39af79dda2ec7871fe4d821ef67c4 (patch)
treeec61ca320368f8128cd531a9272e8e49d5353247 /source/slang/slang-ir-lower-generic-type.cpp
parent7a346b2982c69ef97ebc4b308c77a1f1c88c548f (diff)
Emit simpler vector element access code. (#2770)
* Emit simpler vector element access code * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-lower-generic-type.cpp')
-rw-r--r--source/slang/slang-ir-lower-generic-type.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/slang/slang-ir-lower-generic-type.cpp b/source/slang/slang-ir-lower-generic-type.cpp
index 398db4f78..256978346 100644
--- a/source/slang/slang-ir-lower-generic-type.cpp
+++ b/source/slang/slang-ir-lower-generic-type.cpp
@@ -14,7 +14,7 @@ namespace Slang
{
SharedGenericsLoweringContext* sharedContext;
- void processInst(IRInst* inst)
+ IRInst* processInst(IRInst* inst)
{
// Ensure public struct types has RTTI object defined.
if (as<IRStructType>(inst))
@@ -27,7 +27,7 @@ namespace Slang
// Don't modify type insts themselves.
if (as<IRType>(inst))
- return;
+ return inst;
IRBuilder builderStorage(sharedContext->module);
auto builder = &builderStorage;
@@ -35,7 +35,7 @@ namespace Slang
auto newType = sharedContext->lowerType(builder, inst->getFullType());
if (newType != inst->getFullType())
- inst->setFullType((IRType*)newType);
+ inst = builder->replaceOperand(&inst->typeUse, newType);
switch (inst->getOp())
{
@@ -51,6 +51,7 @@ namespace Slang
}
break;
}
+ return inst;
}
void processModule()
@@ -64,7 +65,7 @@ namespace Slang
sharedContext->workList.removeLast();
sharedContext->workListSet.Remove(inst);
- processInst(inst);
+ inst = processInst(inst);
for (auto child = inst->getLastChild(); child; child = child->getPrevInst())
{