summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-inline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-inline.cpp')
-rw-r--r--source/slang/slang-ir-inline.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/slang/slang-ir-inline.cpp b/source/slang/slang-ir-inline.cpp
index df245f555..f3fa213da 100644
--- a/source/slang/slang-ir-inline.cpp
+++ b/source/slang/slang-ir-inline.cpp
@@ -654,6 +654,19 @@ struct InliningPassBase
};
+static bool hasGenericAsmInst(IRInst* func)
+{
+ auto f = as<IRFunc>(getResolvedInstForDecorations(func));
+ if (!f)
+ return false;
+ for (auto b : f->getBlocks())
+ {
+ if (as<IRGenericAsm>(b->getTerminator()))
+ return true;
+ }
+ return false;
+}
+
/// An inlining pass that inlines calls to `[unsafeForceInlineEarly]` functions
struct MandatoryEarlyInliningPass : InliningPassBase
{
@@ -665,10 +678,15 @@ struct MandatoryEarlyInliningPass : InliningPassBase
bool shouldInline(CallSiteInfo const& info)
{
- if(info.callee->findDecoration<IRUnsafeForceInlineEarlyDecoration>())
- return true;
if (info.callee->findDecoration<IRIntrinsicOpDecoration>())
return true;
+
+ // Never inline a callee that has genericASM instruction.
+ if (hasGenericAsmInst(info.callee))
+ return false;
+
+ if(info.callee->findDecoration<IRUnsafeForceInlineEarlyDecoration>())
+ return true;
return false;
}
};
@@ -782,6 +800,10 @@ struct ForceInliningPass : InliningPassBase
bool shouldInline(CallSiteInfo const& info)
{
+ // Never inline a callee that has genericASM instruction.
+ if (hasGenericAsmInst(info.callee))
+ return false;
+
if (info.callee->findDecoration<IRForceInlineDecoration>() ||
info.callee->findDecoration<IRUnsafeForceInlineEarlyDecoration>()||
info.callee->findDecoration<IRIntrinsicOpDecoration>())