Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
30529056
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
30529056
编写于
7月 10, 2022
作者:
E
Egor Bogatov
提交者:
GitHub
7月 10, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Propagate typeof() during inlining (#71778)
Co-authored-by:
N
Andy Ayers
<
andya@microsoft.com
>
上级
26ec70b1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
26 deletion
+27
-26
src/coreclr/jit/fginline.cpp
src/coreclr/jit/fginline.cpp
+2
-11
src/coreclr/jit/gentree.cpp
src/coreclr/jit/gentree.cpp
+11
-8
src/coreclr/jit/importer.cpp
src/coreclr/jit/importer.cpp
+14
-7
未找到文件。
src/coreclr/jit/fginline.cpp
浏览文件 @
30529056
...
...
@@ -1633,21 +1633,12 @@ Statement* Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
}
else
{
/* The argument is either not used or a const or lcl var */
// The argument is either not used or a const or lcl var
noway_assert
(
!
argInfo
.
argIsUsed
||
argInfo
.
argIsInvariant
||
argInfo
.
argIsLclVar
);
/* Make sure we didnt change argNode's along the way, or else
subsequent uses of the arg would have worked with the bashed value */
if
(
argInfo
.
argIsInvariant
)
{
assert
(
argNode
->
OperIsConst
()
||
argNode
->
gtOper
==
GT_ADDR
);
}
noway_assert
((
argInfo
.
argIsLclVar
==
0
)
==
(
argNode
->
gtOper
!=
GT_LCL_VAR
||
(
argNode
->
gtFlags
&
GTF_GLOB_REF
)));
/* If the argument has side effects, append it */
// If the argument has side effects, append it
if
(
argInfo
.
argHasSideEff
)
{
noway_assert
(
argInfo
.
argIsUsed
==
false
);
...
...
src/coreclr/jit/gentree.cpp
浏览文件 @
30529056
...
...
@@ -12825,6 +12825,7 @@ GenTree* Compiler::gtCreateHandleCompare(genTreeOps oper,
// Checks for
// typeof(...) == obj.GetType()
// typeof(...) == typeof(...)
// typeof(...) == null
// obj1.GetType() == obj2.GetType()
//
// And potentially optimizes away the need to obtain actual
...
...
@@ -12842,17 +12843,19 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
// Screen for the right kinds of operands
GenTree* const op1 = tree->AsOp()->gtOp1;
const TypeProducerKind op1Kind = gtGetTypeProducerKind(op1);
if (op1Kind == TPK_Unknown)
{
return tree;
}
GenTree* const op2 = tree->AsOp()->gtOp2;
const TypeProducerKind op1Kind = gtGetTypeProducerKind(op1);
const TypeProducerKind op2Kind = gtGetTypeProducerKind(op2);
if (op2Kind == TPK_Unknown)
// Fold "typeof(handle) cmp null"
if (((op2Kind == TPK_Null) && (op1Kind == TPK_Handle)) || ((op1Kind == TPK_Null) && (op2Kind == TPK_Handle)))
{
return tree;
GenTree* call = op1Kind == TPK_Handle ? op1 : op2;
GenTree* handle = call->AsCall()->gtArgs.GetArgByIndex(0)->GetNode();
if (gtGetHelperArgClassHandle(handle) != NO_CLASS_HANDLE)
{
return oper == GT_EQ ? gtNewFalse() : gtNewTrue();
}
}
// If both types are created via handles, we can simply compare
...
...
src/coreclr/jit/importer.cpp
浏览文件 @
30529056
...
...
@@ -20256,6 +20256,16 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo,
return;
}
}
else
{
if (curArgVal->IsHelperCall() && gtIsTypeHandleToRuntimeTypeHelper(curArgVal->AsCall()) &&
(gtGetHelperArgClassHandle(curArgVal->AsCall()->gtArgs.GetArgByIndex(0)->GetEarlyNode()) !=
NO_CLASS_HANDLE))
{
inlCurArgInfo->argIsInvariant = true;
inlCurArgInfo->argHasSideEff = false;
}
}
bool isExact = false;
bool isNonNull = false;
...
...
@@ -20292,7 +20302,7 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo,
}
if (inlCurArgInfo->argIsInvariant)
{
printf(" is a constant");
printf(" is a constant
or invariant
");
}
if (inlCurArgInfo->argHasGlobRef)
{
...
...
@@ -20560,8 +20570,7 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
// Try to fold the node in case we have constant arguments.
if (inlArgInfo[i].argIsInvariant)
{
inlArgNode = gtFoldExprConst(inlArgNode);
assert(inlArgNode->OperIsConst());
inlArgNode = gtFoldExpr(inlArgNode);
}
*pInlArgNode = inlArgNode;
}
...
...
@@ -20573,12 +20582,10 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
inlArgInfo[i].argIsLclVar = false;
/* Try to fold the node in case we have constant arguments */
// Try to fold the node in case we have constant arguments.
if (inlArgInfo[i].argIsInvariant)
{
inlArgNode = gtFoldExprConst(inlArgNode);
assert(inlArgNode->OperIsConst());
inlArgNode = gtFoldExpr(inlArgNode);
}
*pInlArgNode = inlArgNode;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录