JIT: Transform 'SELECT(cond, cns, cns)' to 'cns'#127915
JIT: Transform 'SELECT(cond, cns, cns)' to 'cns'#127915BoyBaykiller wants to merge 2 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
| { | ||
| return m_compiler->gtReverseCond(cond); | ||
| } | ||
| else if (trueVal == falseVal) |
There was a problem hiding this comment.
Why here instead of gtFoldExpr so that we avoid ending up with such conditional select nodes in the first place?
There was a problem hiding this comment.
I am not sure how I am supposed to improve gtFoldExpr to handle this.
We enter if-conversion with IR equivalent to:
if (a == b)
{
result = false;
}
else
{
result = false;
}
return result;where a and b are of type double so can't be folded. I am folding based on the true/false paths storing the same values, but that first requires the necessary control flow simplification which if conversion does to collapse this into a single SELECT which can then be analysed. Doesn't look like a gtFoldExpr job to me. Although there might be some opportunity very early on. Anyway I think we should have this either way.
d046532 to
cca783e
Compare
Example:
Note:
gtFoldExprConditionalcan also handle this...