summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-10-04 11:20:35 -0700
committerGitHub <noreply@github.com>2023-10-04 11:20:35 -0700
commitac886fd3e329a9599ed1ac7a6d8b26ca5821046c (patch)
tree87bcafb3985775f9d90303d6a4239eb743164407 /source/slang/slang-ir-util.cpp
parentd87493a46c00be37b820a473c0827bbb865eb222 (diff)
SPIRV compiler performance fixes. (#3258)
* SPIRV compiler performance fixes. * Cleanup. * update project files * Cleanup debug code. * Make redundancy removal non-recursive. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 5ecbc8121..073b8bf96 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -1166,6 +1166,23 @@ UnownedStringSlice getBuiltinFuncName(IRInst* callee)
return decor->getName();
}
+void hoistInstOutOfASMBlocks(IRBlock* block)
+{
+ for (auto inst : block->getChildren())
+ {
+ if (auto asmBlock = as<IRSPIRVAsm>(inst))
+ {
+ IRInst* next = nullptr;
+ for (auto i = asmBlock->getFirstChild(); i; i = next)
+ {
+ next = i->getNextInst();
+ if (!as<IRSPIRVAsmInst>(i) && !as<IRSPIRVAsmOperand>(i))
+ i->insertBefore(asmBlock);
+ }
+ }
+ }
+}
+
UnownedStringSlice getBasicTypeNameHint(IRType* basicType)
{
switch (basicType->getOp())