Reapply "Fold "X relop 0" in assertprop" (#110129)#110142
Conversation
This reverts commit da9381e.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
| if (curAssertion->IsConstantInt32Assertion() && (curAssertion->op1.kind == O1K_LCLVAR) && | ||
| (curAssertion->op1.vn == treeVN)) |
There was a problem hiding this comment.
Why must the first operand be a LCLVAR to allow using these assertions?
There was a problem hiding this comment.
@jakobbotsch because O1K_ARR_BND is a weird assertion (when used with OAK_EQUAL/OAK_NOT_EQUAL). See here
e.g. when we have if (arr.Length == 0) we create an assertion op1 OAK_NOT_EQUAL 0 (inside true edge). To be fair, I think this one should be removed completely and be replaced with O1K_LCLVAR (not sure it works for trees not being GT_LCLVAR).
There was a problem hiding this comment.
To be fair, I think this one should be removed completely
Yeah, it seems like it's just creating wrong assertions that the rest of assertion prop then needs to compensate for? Definitely looks odd that you have to dig into the operands and then the entire assertion changes meaning depending on what the first operand is.
|
/azp run runtime-coreclr libraries-pgo |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This reverts commit da9381e.
The bug was in
optAssertionProp_RangeProperties, when we checkFirst, analyze possible X ==/!= CNS assertions.assertions we need to make sure it'sO1K_LCLVARassertion, not e.g.O1K_ARR_BND