-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Try to fold basic arithmetic operations as part of import #97901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d7a76fd
2ef7a50
c1fdd75
4f8ca05
a62b1ce
a1b4287
5674fb9
dd8309f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7203,6 +7203,9 @@ void Compiler::impImportBlockCode(BasicBlock* block) | |
} | ||
} | ||
|
||
// Fold result, if possible. | ||
op1 = gtFoldExpr(op1); | ||
Comment on lines
+7206
to
+7207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is hit for |
||
|
||
impPushOnStack(op1, tiRetVal); | ||
break; | ||
|
||
|
@@ -7225,14 +7228,23 @@ void Compiler::impImportBlockCode(BasicBlock* block) | |
type = genActualType(op1->TypeGet()); | ||
op1 = gtNewOperNode(oper, type, op1, op2); | ||
|
||
// Fold result, if possible. | ||
op1 = gtFoldExpr(op1); | ||
Comment on lines
+7231
to
+7232
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is hit for |
||
|
||
impPushOnStack(op1, tiRetVal); | ||
break; | ||
|
||
case CEE_NOT: | ||
op1 = impPopStack().val; | ||
impBashVarAddrsToI(op1, nullptr); | ||
|
||
type = genActualType(op1->TypeGet()); | ||
impPushOnStack(gtNewOperNode(GT_NOT, type, op1), tiRetVal); | ||
op1 = gtNewOperNode(GT_NOT, type, op1); | ||
|
||
// Fold result, if possible. | ||
op1 = gtFoldExpr(op1); | ||
Comment on lines
+7244
to
+7245
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is hit for |
||
|
||
impPushOnStack(op1, tiRetVal); | ||
break; | ||
|
||
case CEE_CKFINITE: | ||
|
@@ -7960,7 +7972,12 @@ void Compiler::impImportBlockCode(BasicBlock* block) | |
case CEE_NEG: | ||
op1 = impPopStack().val; | ||
impBashVarAddrsToI(op1, nullptr); | ||
impPushOnStack(gtNewOperNode(GT_NEG, genActualType(op1->gtType), op1), tiRetVal); | ||
op1 = gtNewOperNode(GT_NEG, genActualType(op1->gtType), op1); | ||
|
||
// Fold result, if possible. | ||
op1 = gtFoldExpr(op1); | ||
Comment on lines
+7977
to
+7978
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is hit for |
||
|
||
impPushOnStack(op1, tiRetVal); | ||
break; | ||
|
||
case CEE_POP: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you hit that assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its what was discussed further up in #97901 (comment)
Basically, we have an IL test that explicitly adds two
ldsflda
. It does so after aconv.i4
, but that is anop
on 32-bit and a user can write such IL without theconv.i4
as well, so the assert was already somewhat incorrect just not hit due to us not constant folding this early.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Yeah I think we discussed it with SingleAccretion at some point